Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientInterface ¶
type ClientInterface interface {
SendMessage(msg interface{})
// SendMessageBlocking enqueues with backpressure for REQ-fulfillment
// loops that need producer/consumer rate parity. Never call from
// BroadcastEvent. Returns non-nil if the client has gone away.
SendMessageBlocking(msg interface{}) error
GetWS() *websocket.Conn
GetSubscriptions() map[string][]Filter
SetSubscription(subID string, filters []Filter)
DeleteSubscription(subID string)
SubscriptionCount() int
ForEachSubscription(fn func(subID string, filters []Filter))
CloseClient()
IsConnected() bool
// AllowReq checks the client's per-connection REQ rate limiter.
// Returns (true, "") if allowed, (false, reason) if rate limited.
AllowReq() (bool, string)
// AllowEvent checks the client's per-connection event rate limiter.
AllowEvent(kind int, category string) (bool, string)
}
ClientInterface abstracts WebSocket clients
type Filter ¶
type Filter struct {
IDs []string `json:"ids,omitempty"`
Authors []string `json:"authors,omitempty"`
Kinds []int `json:"kinds,omitempty"`
Tags map[string][]string `json:"#,omitempty"` // Fixed: should be "#" for tag filters
Since *time.Time `json:"since,omitempty"`
Until *time.Time `json:"until,omitempty"`
Limit *int `json:"limit,omitempty"`
Search string `json:"search,omitempty"` // NIP-50: fulltext search query
}
Filter represents the criteria used to query events
func (Filter) MatchesEvent ¶ added in v0.5.0
MatchesEvent returns true if the event satisfies all filter criteria per NIP-01. An empty/zero field means "match all" for that field.
func (Filter) ToSubscriptionFilter ¶ added in v0.4.1
ToSubscriptionFilter converts Filter to a relay-compatible format
type Subscription ¶
Click to show internal directories.
Click to hide internal directories.