Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultDisconnectAdvice = &DisconnectAdvice{Reason: "", Reconnect: true}
DefaultDisconnectAdvice is no reason and reconnect.
View Source
var ( // ShutdownSemaphoreChanBufferSize limits graceful disconnects concurrency on // node shutdown. ShutdownSemaphoreChanBufferSize = 1000 )
Functions ¶
This section is empty.
Types ¶
type AdminConn ¶
type AdminConn interface { // UID returns unique admin connection id. UID() string // Handle message coming from admin client. Handle(message []byte) error // Send allows to send message to admin connection. Send(message []byte) error // Close closes admin's connection. Close(*DisconnectAdvice) error }
AdminConn is an interface abstracting all methods used by application to interact with admin connection.
type AdminHub ¶
type AdminHub interface { Add(c AdminConn) error Remove(c AdminConn) error NumAdmins() int Broadcast(message []byte) error Shutdown() error }
AdminHub is an interface describing admin connections to node.
type ClientConn ¶
type ClientConn interface { // UID returns unique connection id. UID() string // User return user ID associated with connection. User() string // Channels returns a slice of channels connection subscribed to. Channels() []string // Handle message coming from client. Handle(message []byte) error // Send allows to send message to connection client. Send(message []byte) error // Unsubscribe allows to unsubscribe connection from channel. Unsubscribe(ch string) error // Close closes client's connection. Close(*DisconnectAdvice) error }
ClientConn is an interface abstracting all methods used by application to interact with client connection.
type ClientHub ¶
type ClientHub interface { Add(c ClientConn) error Remove(c ClientConn) error AddSub(ch string, c ClientConn) (bool, error) RemoveSub(ch string, c ClientConn) (bool, error) Broadcast(ch string, message []byte) error NumSubscribers(ch string) int NumClients() int NumUniqueClients() int NumChannels() int Channels() []string UserConnections(user string) map[string]ClientConn Shutdown() error }
ClientHub is an interface describing current client connections to node.
type DisconnectAdvice ¶
type DisconnectAdvice struct { Reason string `json:"reason"` Reconnect bool `json:"reconnect"` // contains filtered or unexported fields }
DisconnectAdvice sent to client when we want it to gracefully disconnect.
func (*DisconnectAdvice) JSONString ¶
func (a *DisconnectAdvice) JSONString() (string, error)
JSONString contains cached representation of DisconnectAdvice as JSON.
Click to show internal directories.
Click to hide internal directories.