Documentation
¶
Index ¶
- Constants
- func EventFilter(filter Filter) primitive.M
- func ListenForMessages(ctx context.Context, r MessageReader) <-chan WebsocketMessage
- func SubscriptionFilter(e event.Event) primitive.M
- type A
- type Filter
- type M
- type MessageReader
- type MessageType
- type Subscription
- type SubscriptionID
- type WebsocketMessage
Constants ¶
View Source
const ( EVENT = "EVENT" REQ = "REQ" CLOSE = "CLOSE" )
Variables ¶
This section is empty.
Functions ¶
func EventFilter ¶
MongoDB filter for StructuredEvents matching filter.
func ListenForMessages ¶
func ListenForMessages(ctx context.Context, r MessageReader) <-chan WebsocketMessage
Types ¶
type Filter ¶
type Filter struct {
IDs []event.ID `json:"ids" bson:"ids"`
Authors []event.PubKey `json:"authors" bson:"authors"`
Kinds []event.Kind `json:"kinds" bson:"kinds"`
E []event.ID `json:"#e" bson:"#e"`
P []event.PubKey `json:"#p" bson:"#p"`
Since event.Timestamp `json:"since" bson:"since"`
Until event.Timestamp `json:"until" bson:"until"`
Limit int64 `json:"limit" bson:"limit"`
}
type MessageReader ¶
type MessageType ¶
type MessageType string
type Subscription ¶
type Subscription struct {
ID SubscriptionID `json:"id" bson:"id"`
Filters []Filter `bson:"filter"`
}
func (Subscription) UniqueID ¶
func (e Subscription) UniqueID() string
func (Subscription) UniqueIDFieldName ¶
func (e Subscription) UniqueIDFieldName(format string) (string, error)
type SubscriptionID ¶
type SubscriptionID string
type WebsocketMessage ¶
type WebsocketMessage struct {
MsgType MessageType
Err error
Value interface{}
}
func (WebsocketMessage) AsCLOSE ¶
func (msg WebsocketMessage) AsCLOSE() (SubscriptionID, bool)
func (WebsocketMessage) AsREQ ¶
func (msg WebsocketMessage) AsREQ() (Subscription, bool)
Click to show internal directories.
Click to hide internal directories.