Documentation ¶
Index ¶
- Variables
- type Client
- func (c *Client) Close()
- func (c *Client) Connect() error
- func (c *Client) Disconnect() error
- func (c *Client) GetSubscription(channel string) (*Subscription, bool)
- func (c *Client) History(ctx context.Context, channel string, opts ...HistoryOption) (HistoryResult, error)
- func (c *Client) NewSubscription(channel string, config ...SubscriptionConfig) (*Subscription, error)
- func (c *Client) OnConnected(handler ConnectedHandler)
- func (c *Client) OnConnecting(handler ConnectingHandler)
- func (c *Client) OnDisconnected(handler DisconnectHandler)
- func (c *Client) OnError(handler ErrorHandler)
- func (c *Client) OnJoin(handler ServerJoinHandler)
- func (c *Client) OnLeave(handler ServerLeaveHandler)
- func (c *Client) OnMessage(handler MessageHandler)
- func (c *Client) OnPublication(handler ServerPublicationHandler)
- func (c *Client) OnSubscribed(handler ServerSubscribedHandler)
- func (c *Client) OnSubscribing(handler ServerSubscribingHandler)
- func (c *Client) OnUnsubscribed(handler ServerUnsubscribedHandler)
- func (c *Client) Presence(ctx context.Context, channel string) (PresenceResult, error)
- func (c *Client) PresenceStats(ctx context.Context, channel string) (PresenceStatsResult, error)
- func (c *Client) Publish(ctx context.Context, channel string, data []byte) (PublishResult, error)
- func (c *Client) RPC(ctx context.Context, method string, data []byte) (RPCResult, error)
- func (c *Client) RemoveSubscription(sub *Subscription) error
- func (c *Client) Send(ctx context.Context, data []byte) error
- func (c *Client) SetToken(token string)
- func (c *Client) State() State
- func (c *Client) Subscriptions() map[string]*Subscription
- type ClientInfo
- type Config
- type ConfigurationError
- type ConnectError
- type ConnectedEvent
- type ConnectedHandler
- type ConnectingEvent
- type ConnectingHandler
- type ConnectionTokenEvent
- type DisconnectHandler
- type DisconnectedEvent
- type Error
- type ErrorEvent
- type ErrorHandler
- type HistoryOption
- type HistoryOptions
- type HistoryResult
- type JoinEvent
- type JoinHandler
- type LeaveEvent
- type LeaveHandler
- type MessageEvent
- type MessageHandler
- type PresenceResult
- type PresenceStats
- type PresenceStatsResult
- type Publication
- type PublicationEvent
- type PublicationHandler
- type PublishResult
- type RPCResult
- type RefreshError
- type ServerJoinEvent
- type ServerJoinHandler
- type ServerLeaveEvent
- type ServerLeaveHandler
- type ServerPublicationEvent
- type ServerPublicationHandler
- type ServerSubscribedEvent
- type ServerSubscribedHandler
- type ServerSubscribingEvent
- type ServerSubscribingHandler
- type ServerUnsubscribedEvent
- type ServerUnsubscribedHandler
- type State
- type StreamPosition
- type SubState
- type SubscribedEvent
- type SubscribedHandler
- type SubscribingEvent
- type SubscribingHandler
- type Subscription
- func (s *Subscription) History(ctx context.Context, opts ...HistoryOption) (HistoryResult, error)
- func (s *Subscription) OnError(handler SubscriptionErrorHandler)
- func (s *Subscription) OnJoin(handler JoinHandler)
- func (s *Subscription) OnLeave(handler LeaveHandler)
- func (s *Subscription) OnPublication(handler PublicationHandler)
- func (s *Subscription) OnSubscribed(handler SubscribedHandler)
- func (s *Subscription) OnSubscribing(handler SubscribingHandler)
- func (s *Subscription) OnUnsubscribed(handler UnsubscribedHandler)
- func (s *Subscription) Presence(ctx context.Context) (PresenceResult, error)
- func (s *Subscription) PresenceStats(ctx context.Context) (PresenceStatsResult, error)
- func (s *Subscription) Publish(ctx context.Context, data []byte) (PublishResult, error)
- func (s *Subscription) State() SubState
- func (s *Subscription) Subscribe() error
- func (s *Subscription) Unsubscribe() error
- type SubscriptionConfig
- type SubscriptionErrorEvent
- type SubscriptionErrorHandler
- type SubscriptionRefreshError
- type SubscriptionSubscribeError
- type SubscriptionTokenEvent
- type TransportError
- type UnsubscribeResult
- type UnsubscribedEvent
- type UnsubscribedHandler
Constants ¶
This section is empty.
Variables ¶
var ( // ErrTimeout returned if operation timed out. ErrTimeout = errors.New("timeout") // ErrClientDisconnected can be returned if client goes to // disconnected state while operation in progress. ErrClientDisconnected = errors.New("client disconnected") // ErrClientClosed can be returned if client is closed. ErrClientClosed = errors.New("client closed") // ErrSubscriptionUnsubscribed returned if Subscription is unsubscribed. ErrSubscriptionUnsubscribed = errors.New("subscription unsubscribed") // ErrDuplicateSubscription returned if subscription to the same channel // already registered in current client instance. This is due to the fact // that server does not allow subscribing to the same channel twice for // the same connection. ErrDuplicateSubscription = errors.New("duplicate subscription") // from GetToken function to indicate lack of operation permission. ErrUnauthorized = errors.New("unauthorized") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents client connection to Centrifugo or Centrifuge library based server. It provides methods to set various event handlers, subscribe channels, call RPC commands etc. Call client Connect method to trigger actual connection with a server. Call client Close method to clean up state when you don't need client instance anymore.
func NewJsonClient ¶ added in v0.8.0
NewJsonClient initializes Client which uses JSON-based protocol internally. After client initialized call Client.Connect method. Use Client.NewSubscription to create Subscription objects. The provided endpoint must be a valid URL with ws:// or wss:// scheme – otherwise NewJsonClient will panic.
func NewProtobufClient ¶ added in v0.8.0
NewProtobufClient initializes Client which uses Protobuf-based protocol internally. After client initialized call Client.Connect method. Use Client.NewSubscription to create Subscription objects. The provided endpoint must be a valid URL with ws:// or wss:// scheme – otherwise NewProtobufClient will panic.
func (*Client) Close ¶
func (c *Client) Close()
Close closes Client and cleanups resources. Client is unusable after this. Use this method if you don't need client anymore, otherwise look at Client.Disconnect.
func (*Client) Connect ¶
Connect dials to server and sends connect message. Will return an error if first dial with a server failed. In case of failure client will automatically reconnect. To temporary disconnect from a server call Client.Disconnect.
func (*Client) Disconnect ¶
Disconnect client from server. It's still possible to connect again later. If you don't need Client anymore – use Client.Close.
func (*Client) GetSubscription ¶ added in v0.9.0
func (c *Client) GetSubscription(channel string) (*Subscription, bool)
GetSubscription allows getting Subscription from the internal client registry.
func (*Client) History ¶ added in v0.7.0
func (c *Client) History(ctx context.Context, channel string, opts ...HistoryOption) (HistoryResult, error)
History for a channel without being subscribed.
func (*Client) NewSubscription ¶ added in v0.2.0
func (c *Client) NewSubscription(channel string, config ...SubscriptionConfig) (*Subscription, error)
NewSubscription allocates new Subscription on a channel. As soon as Subscription successfully created Client keeps reference to it inside internal map registry to manage automatic resubscribe on reconnect. After creating Subscription call its Subscription.Subscribe method to actually start subscribing process. To temporarily unsubscribe call Subscription.Unsubscribe. If you finished with Subscription then you can remove it from the internal registry by calling Client.RemoveSubscription method.
func (*Client) OnConnected ¶ added in v0.9.0
func (c *Client) OnConnected(handler ConnectedHandler)
OnConnected is a function to handle connect event.
func (*Client) OnConnecting ¶ added in v0.9.0
func (c *Client) OnConnecting(handler ConnectingHandler)
OnConnecting is a function to handle connecting event.
func (*Client) OnDisconnected ¶ added in v0.9.0
func (c *Client) OnDisconnected(handler DisconnectHandler)
OnDisconnected is a function to handle moveToDisconnected event.
func (*Client) OnError ¶ added in v0.2.0
func (c *Client) OnError(handler ErrorHandler)
OnError is a function that will receive unhandled errors for logging.
func (*Client) OnJoin ¶ added in v0.9.0
func (c *Client) OnJoin(handler ServerJoinHandler)
OnJoin sets function to handle Join event from server-side subscriptions.
func (*Client) OnLeave ¶ added in v0.9.0
func (c *Client) OnLeave(handler ServerLeaveHandler)
OnLeave sets function to handle Leave event from server-side subscriptions.
func (*Client) OnMessage ¶ added in v0.2.0
func (c *Client) OnMessage(handler MessageHandler)
OnMessage allows processing async message from server to client.
func (*Client) OnPublication ¶ added in v0.9.0
func (c *Client) OnPublication(handler ServerPublicationHandler)
OnPublication sets function to handle Publications from server-side subscriptions.
func (*Client) OnSubscribed ¶ added in v0.9.0
func (c *Client) OnSubscribed(handler ServerSubscribedHandler)
OnSubscribed sets function to handle server-side subscription subscribe events.
func (*Client) OnSubscribing ¶ added in v0.9.0
func (c *Client) OnSubscribing(handler ServerSubscribingHandler)
OnSubscribing sets function to handle server-side subscription subscribing events.
func (*Client) OnUnsubscribed ¶ added in v0.9.0
func (c *Client) OnUnsubscribed(handler ServerUnsubscribedHandler)
OnUnsubscribed sets function to handle unsubscribe from server-side subscriptions.
func (*Client) PresenceStats ¶ added in v0.7.0
PresenceStats for a channel without being subscribed.
func (*Client) RPC ¶
RPC allows sending data to a server and waiting for a response. RPC handler must be registered on server.
func (*Client) RemoveSubscription ¶ added in v0.9.0
func (c *Client) RemoveSubscription(sub *Subscription) error
RemoveSubscription removes Subscription from the internal client registry. Make sure Subscription is in unsubscribed state before removing it.
func (*Client) Send ¶
Send message to server without waiting for response. Message handler must be registered on server.
func (*Client) State ¶ added in v0.9.0
State returns current Client state. Note that while you are processing this state - Client can move to a new one.
func (*Client) Subscriptions ¶ added in v0.9.0
func (c *Client) Subscriptions() map[string]*Subscription
Subscriptions returns a map with all currently registered client-side subscriptions.
type ClientInfo ¶
type ClientInfo struct { // Client is a client unique id. Client string // User is an ID of authenticated user. Zero value means anonymous user. User string // ConnInfo is additional information about connection. ConnInfo []byte // ChanInfo is additional information about connection in context of // channel subscription. ChanInfo []byte }
ClientInfo contains information about client connection.
type Config ¶
type Config struct { // Token for a connection authentication. Token string // GetToken called by SDK to get or refresh connection token. GetToken func(ConnectionTokenEvent) (string, error) // Data is an arbitrary data which can be sent to a server in a Connect command. // Make sure it's a valid JSON when using JSON protocol client. Data []byte // CookieJar specifies the cookie jar to send in WebSocket Upgrade request. CookieJar http.CookieJar // Header specifies custom HTTP Header to send in WebSocket Upgrade request. Header http.Header // Name allows setting client name. You should only use a limited // amount of client names throughout your applications – i.e. don't // make it unique per user for example, this name semantically represents // an environment from which client connects. // Zero value means "go". Name string // Version allows setting client version. This is an application // specific information. By default, no version set. Version string // NetDialContext specifies the dial function for creating TCP connections. If // NetDialContext is nil, net.DialContext is used. NetDialContext func(ctx context.Context, network, addr string) (net.Conn, error) // ReadTimeout is how long to wait read operations to complete. // Zero value means 5 * time.Second. ReadTimeout time.Duration // WriteTimeout is Websocket write timeout. // Zero value means 1 * time.Second. WriteTimeout time.Duration // HandshakeTimeout specifies the duration for the handshake to complete. // Zero value means 1 * time.Second. HandshakeTimeout time.Duration // MaxServerPingDelay used to set maximum delay of ping from server. // Zero value means 10 * time.Second. MaxServerPingDelay time.Duration // TLSConfig specifies the TLS configuration to use with tls.Client. // If nil, the default configuration is used. TLSConfig *tls.Config // EnableCompression specifies if the client should attempt to negotiate // per message compression (RFC 7692). Setting this value to true does not // guarantee that compression will be supported. Currently, only "no context // takeover" modes are supported. EnableCompression bool }
Config contains various client options.
type ConfigurationError ¶ added in v0.10.0
type ConfigurationError struct {
Err error
}
func (ConfigurationError) Error ¶ added in v0.10.0
func (r ConfigurationError) Error() string
type ConnectError ¶ added in v0.9.0
type ConnectError struct {
Err error
}
func (ConnectError) Error ¶ added in v0.9.0
func (c ConnectError) Error() string
type ConnectedEvent ¶ added in v0.9.0
ConnectedEvent is a connected event context passed to OnConnected callback.
type ConnectedHandler ¶ added in v0.9.0
type ConnectedHandler func(ConnectedEvent)
ConnectedHandler is an interface describing how to handle connect event.
type ConnectingEvent ¶ added in v0.9.0
ConnectingEvent is a connecting event context passed to OnConnecting callback.
type ConnectingHandler ¶ added in v0.9.0
type ConnectingHandler func(ConnectingEvent)
ConnectingHandler is an interface describing how to handle connecting event.
type ConnectionTokenEvent ¶ added in v0.9.0
type ConnectionTokenEvent struct { }
ConnectionTokenEvent may contain some useful contextual information in the future. For now, it's empty.
type DisconnectHandler ¶
type DisconnectHandler func(DisconnectedEvent)
DisconnectHandler is an interface describing how to handle moveToDisconnected event.
type DisconnectedEvent ¶ added in v0.9.0
DisconnectedEvent is a disconnected event context passed to OnDisconnected callback.
type ErrorEvent ¶
type ErrorEvent struct {
Error error
}
ErrorEvent is an error event context passed to OnError callback.
type ErrorHandler ¶
type ErrorHandler func(ErrorEvent)
ErrorHandler is an interface describing how to handle error event.
type HistoryOption ¶ added in v0.8.0
type HistoryOption func(options *HistoryOptions)
func WithHistoryLimit ¶ added in v0.8.0
func WithHistoryLimit(limit int32) HistoryOption
func WithHistoryReverse ¶ added in v0.8.1
func WithHistoryReverse(reverse bool) HistoryOption
func WithHistorySince ¶ added in v0.8.0
func WithHistorySince(sp *StreamPosition) HistoryOption
type HistoryOptions ¶ added in v0.8.0
type HistoryOptions struct { Limit int32 Since *StreamPosition Reverse bool }
type HistoryResult ¶ added in v0.6.0
type HistoryResult struct { Publications []Publication Offset uint64 Epoch string }
HistoryResult contains the result of history op.
type JoinEvent ¶
type JoinEvent struct {
ClientInfo
}
JoinEvent has info about user who joined channel.
type JoinHandler ¶
type JoinHandler func(JoinEvent)
JoinHandler is a function to handle join messages.
type LeaveEvent ¶
type LeaveEvent struct {
ClientInfo
}
LeaveEvent has info about user who left channel.
type LeaveHandler ¶
type LeaveHandler func(LeaveEvent)
LeaveHandler is a function to handle leave messages.
type MessageEvent ¶
type MessageEvent struct {
Data []byte
}
MessageEvent is an event for async message from server to client.
type MessageHandler ¶
type MessageHandler func(MessageEvent)
MessageHandler is an interface describing how to handle async message from server.
type PresenceResult ¶ added in v0.6.0
type PresenceResult struct {
Clients map[string]ClientInfo
}
PresenceResult contains the result of presence op.
type PresenceStats ¶
PresenceStats represents short presence information.
type PresenceStatsResult ¶ added in v0.6.0
type PresenceStatsResult struct {
PresenceStats
}
PresenceStatsResult wraps presence stats.
type Publication ¶
type Publication struct { // Offset is an incremental position number inside history stream. // Zero value means that channel does not maintain Publication stream. Offset uint64 // Data published to channel. Data []byte // Info is optional information about client connection published // this data to channel. Info *ClientInfo // Tags contain custom key-value pairs attached to Publication. Tags map[string]string }
Publication is a data sent to channel.
type PublicationEvent ¶ added in v0.9.0
type PublicationEvent struct {
Publication
}
PublicationEvent has info about received channel Publication.
type PublicationHandler ¶ added in v0.9.0
type PublicationHandler func(PublicationEvent)
PublicationHandler is a function to handle messages published in channels.
type PublishResult ¶ added in v0.6.0
type PublishResult struct{}
PublishResult contains the result of publish.
type RPCResult ¶ added in v0.6.0
type RPCResult struct {
Data []byte
}
RPCResult contains data returned from server as RPC result.
type RefreshError ¶ added in v0.9.0
type RefreshError struct {
Err error
}
func (RefreshError) Error ¶ added in v0.9.0
func (r RefreshError) Error() string
type ServerJoinEvent ¶ added in v0.6.0
type ServerJoinEvent struct { Channel string ClientInfo }
ServerJoinEvent has info about user who left channel.
type ServerJoinHandler ¶ added in v0.6.0
type ServerJoinHandler func(ServerJoinEvent)
ServerJoinHandler is an interface describing how to handle Join events from server-side subscriptions.
type ServerLeaveEvent ¶ added in v0.6.0
type ServerLeaveEvent struct { Channel string ClientInfo }
ServerLeaveEvent has info about user who joined channel.
type ServerLeaveHandler ¶ added in v0.6.0
type ServerLeaveHandler func(ServerLeaveEvent)
ServerLeaveHandler is an interface describing how to handle Leave events from server-side subscriptions.
type ServerPublicationEvent ¶ added in v0.9.0
type ServerPublicationEvent struct { Channel string Publication }
ServerPublicationEvent has info about received channel Publication.
type ServerPublicationHandler ¶ added in v0.9.0
type ServerPublicationHandler func(ServerPublicationEvent)
ServerPublicationHandler is an interface describing how to handle Publication from server-side subscriptions.
type ServerSubscribedEvent ¶ added in v0.9.0
type ServerSubscribedHandler ¶ added in v0.9.0
type ServerSubscribedHandler func(ServerSubscribedEvent)
ServerSubscribedHandler is an interface describing how to handle subscribe events from server-side subscriptions.
type ServerSubscribingEvent ¶ added in v0.9.0
type ServerSubscribingEvent struct {
Channel string
}
ServerSubscribingEvent is an event passed to subscribing event handler.
type ServerSubscribingHandler ¶ added in v0.9.0
type ServerSubscribingHandler func(ServerSubscribingEvent)
ServerSubscribingHandler is an interface describing how to handle subscribing events for server-side subscriptions.
type ServerUnsubscribedEvent ¶ added in v0.9.0
type ServerUnsubscribedEvent struct {
Channel string
}
ServerUnsubscribedEvent is an event passed to unsubscribe event handler.
type ServerUnsubscribedHandler ¶ added in v0.9.0
type ServerUnsubscribedHandler func(ServerUnsubscribedEvent)
ServerUnsubscribedHandler is an interface describing how to handle unsubscribe events from server-side subscriptions.
type StreamPosition ¶ added in v0.8.0
type SubscribedEvent ¶ added in v0.9.0
type SubscribedEvent struct { Positioned bool Recoverable bool StreamPosition *StreamPosition WasRecovering bool Recovered bool Data []byte }
SubscribedEvent is an event context passed to subscribe success callback.
type SubscribedHandler ¶ added in v0.9.0
type SubscribedHandler func(SubscribedEvent)
SubscribedHandler is a function to handle subscribe success event.
type SubscribingEvent ¶ added in v0.9.0
SubscribingEvent is an event passed to subscribing event handler.
type SubscribingHandler ¶ added in v0.9.0
type SubscribingHandler func(SubscribingEvent)
SubscribingHandler is a function to handle subscribe success event.
type Subscription ¶
type Subscription struct { // Channel for a subscription. Channel string // contains filtered or unexported fields }
Subscription represents client subscription to channel. DO NOT initialize this struct directly, instead use Client.NewSubscription method to create channel subscriptions.
func (*Subscription) History ¶
func (s *Subscription) History(ctx context.Context, opts ...HistoryOption) (HistoryResult, error)
History allows extracting channel history. By default, it returns current stream top position without publications. Use WithHistoryLimit with a value > 0 to make this func to return publications.
func (*Subscription) OnError ¶ added in v0.9.0
func (s *Subscription) OnError(handler SubscriptionErrorHandler)
OnError allows setting SubscriptionErrorHandler to SubEventHandler.
func (*Subscription) OnJoin ¶ added in v0.2.0
func (s *Subscription) OnJoin(handler JoinHandler)
OnJoin allows setting JoinHandler to SubEventHandler.
func (*Subscription) OnLeave ¶ added in v0.2.0
func (s *Subscription) OnLeave(handler LeaveHandler)
OnLeave allows setting LeaveHandler to SubEventHandler.
func (*Subscription) OnPublication ¶ added in v0.9.0
func (s *Subscription) OnPublication(handler PublicationHandler)
OnPublication allows setting PublicationHandler to SubEventHandler.
func (*Subscription) OnSubscribed ¶ added in v0.9.0
func (s *Subscription) OnSubscribed(handler SubscribedHandler)
OnSubscribed allows setting SubscribedHandler to SubEventHandler.
func (*Subscription) OnSubscribing ¶ added in v0.9.0
func (s *Subscription) OnSubscribing(handler SubscribingHandler)
OnSubscribing allows setting SubscribingHandler to SubEventHandler.
func (*Subscription) OnUnsubscribed ¶ added in v0.9.0
func (s *Subscription) OnUnsubscribed(handler UnsubscribedHandler)
OnUnsubscribed allows setting UnsubscribedHandler to SubEventHandler.
func (*Subscription) Presence ¶
func (s *Subscription) Presence(ctx context.Context) (PresenceResult, error)
Presence allows extracting channel presence.
func (*Subscription) PresenceStats ¶
func (s *Subscription) PresenceStats(ctx context.Context) (PresenceStatsResult, error)
PresenceStats allows extracting channel presence stats.
func (*Subscription) Publish ¶
func (s *Subscription) Publish(ctx context.Context, data []byte) (PublishResult, error)
Publish allows publishing data to the subscription channel.
func (*Subscription) State ¶ added in v0.9.0
func (s *Subscription) State() SubState
func (*Subscription) Subscribe ¶
func (s *Subscription) Subscribe() error
Subscribe allows initiating subscription process.
func (*Subscription) Unsubscribe ¶
func (s *Subscription) Unsubscribe() error
Unsubscribe allows unsubscribing from channel.
type SubscriptionConfig ¶ added in v0.9.0
type SubscriptionConfig struct { // Data is an arbitrary data to pass to a server in each subscribe request. Data []byte // Token for Subscription. Token string // GetToken called to get or refresh private channel subscription token. GetToken func(SubscriptionTokenEvent) (string, error) // Positioned flag asks server to make Subscription positioned. Only makes sense // in channels with history stream on. Positioned bool // Recoverable flag asks server to make Subscription recoverable. Only makes sense // in channels with history stream on. Recoverable bool // JoinLeave flag asks server to push join/leave messages. JoinLeave bool }
SubscriptionConfig allows setting Subscription options.
type SubscriptionErrorEvent ¶ added in v0.9.0
type SubscriptionErrorEvent struct {
Error error
}
SubscriptionErrorEvent is a subscribe error event context passed to event callback.
type SubscriptionErrorHandler ¶ added in v0.9.0
type SubscriptionErrorHandler func(SubscriptionErrorEvent)
SubscriptionErrorHandler is a function to handle subscribe error event.
type SubscriptionRefreshError ¶ added in v0.9.0
type SubscriptionRefreshError struct {
Err error
}
func (SubscriptionRefreshError) Error ¶ added in v0.9.0
func (s SubscriptionRefreshError) Error() string
type SubscriptionSubscribeError ¶ added in v0.9.0
type SubscriptionSubscribeError struct {
Err error
}
func (SubscriptionSubscribeError) Error ¶ added in v0.9.0
func (s SubscriptionSubscribeError) Error() string
type SubscriptionTokenEvent ¶ added in v0.9.0
type SubscriptionTokenEvent struct {
Channel string
}
SubscriptionTokenEvent contains info required to get subscription token when client wants to subscribe on private channel.
type TransportError ¶ added in v0.9.0
type TransportError struct {
Err error
}
func (TransportError) Error ¶ added in v0.9.0
func (t TransportError) Error() string
type UnsubscribeResult ¶ added in v0.6.0
type UnsubscribeResult struct{}
type UnsubscribedEvent ¶ added in v0.9.0
UnsubscribedEvent is an event passed to unsubscribe event handler.
type UnsubscribedHandler ¶ added in v0.9.0
type UnsubscribedHandler func(UnsubscribedEvent)
UnsubscribedHandler is a function to handle unsubscribe event.