Versions in this module Expand all Collapse all v1 v1.0.11 Jan 25, 2024 Changes in this version + func IsValidRelayURL(u string) bool + type T struct + AssumeValid bool + Connection *connection.C + ConnectionError error + RequestHeader http.Header + Subscriptions *xsync.MapOf[string, *subscription.T] + func Connect(c context.T, url string, opts ...Option) (*T, error) + func MustConnect(url string) *T + func NewRelay(c context.T, url string, opts ...Option) *T + func (r *T) Auth(c context.T, sign func(ev *event.T) error) error + func (r *T) Close() error + func (r *T) Connect(c context.T) (err error) + func (r *T) Context() context.T + func (r *T) Count(c context.T, filters filters.T, opts ...subscriptionoption.I) (int64, error) + func (r *T) Delete(key string) + func (r *T) IsConnected() bool + func (r *T) MessageReadLoop(conn *connection.C) + func (r *T) PrepareSubscription(c context.T, f filters.T, opts ...subscriptionoption.I) *subscription.T + func (r *T) Publish(c context.T, ev *event.T) error + func (r *T) QuerySync(c context.T, f *filter.T, opts ...subscriptionoption.I) ([]*event.T, error) + func (r *T) String() string + func (r *T) Subscribe(c context.T, f filters.T, opts ...subscriptionoption.I) (*subscription.T, error) + func (r *T) URL() string + func (r *T) Write(msg []byte) <-chan error v1.0.10 Jan 11, 2024 Changes in this version + type EventMessage struct + Event event.T + Relay string + type Option interface + IsRelayOption func() + type Relay struct + AssumeValid bool + Connection *connect.Connection + Err error + RequestHeader http.Header + Subscriptions *xsync.MapOf[string, *Subscription] + URL string + func New(c context.T, url string, opts ...Option) (r *Relay) + func RelayConnect(c context.T, url string, opts ...Option) (r *Relay, e error) + func (r *Relay) Auth(c context.T, event *event.T) (s Status, e error) + func (r *Relay) Close() (e error) + func (r *Relay) Connect(c context.T) (e error) + func (r *Relay) Context() context.T + func (r *Relay) Count(c context.T, filters filters.T, opts ...SubscriptionOption) (cnt int64, e error) + func (r *Relay) IsConnected() bool + func (r *Relay) PrepareSubscription(c context.T, filters filters.T, opts ...SubscriptionOption) (s *Subscription) + func (r *Relay) Publish(c context.T, evt *event.T) (s Status, e error) + func (r *Relay) QuerySync(c context.T, f *filter.T, opts ...SubscriptionOption) (evs []*event.T, e error) + func (r *Relay) String() string + func (r *Relay) Subscribe(c context.T, filters filters.T, opts ...SubscriptionOption) (s *Subscription, e error) + func (r *Relay) Write(msg []byte) <-chan error + type Status int + const PublishStatusFailed + const PublishStatusSent + const PublishStatusSucceeded + func (s Status) String() string + type Subscription struct + Cancel context.F + Context context.T + CountResult chan int64 + Counter int + EndOfStoredEvents chan struct{} + Eosed atomic.Bool + Events chan *event.T + Filters filters.T + Label string + Live atomic.Bool + Relay *Relay + Storedwg sync.WaitGroup + func (sub *Subscription) Close() + func (sub *Subscription) DispatchEose() + func (sub *Subscription) DispatchEvent(evt *event.T) + func (sub *Subscription) Fire() (e error) + func (sub *Subscription) GetID() string + func (sub *Subscription) Start() + func (sub *Subscription) Sub(_ context.T, filters filters.T) + func (sub *Subscription) Unsub() + type SubscriptionOption interface + IsSubscriptionOption func() + type WithAuthHandler func(c context.T, authEvent *event.T) (ok bool) + func (_ WithAuthHandler) IsRelayOption() + type WithLabel string + func (_ WithLabel) IsSubscriptionOption() + type WithNoticeHandler func(notice string) + func (_ WithNoticeHandler) IsRelayOption() + type WriteRequest struct + Answer chan error + Msg []byte