Versions in this module Expand all Collapse all v1 v1.0.0 Feb 16, 2020 Changes in this version + type Client struct + func NewClient(options ClientOptions, id UUID, upgrader WebsocketConnectionUpgrader, ...) *Client + func (c *Client) Close() error + func (c *Client) Connect(response http.ResponseWriter, request *http.Request) error + func (c *Client) ID() UUID + func (c *Client) OnError(handler ErrorHandler) + func (c *Client) OnReceive(handler ReceiveHandler) + func (c *Client) Send(message Message) error + type ClientConnectError struct + Err error + ID UUID + func IsClientConnectError(err error) (*ClientConnectError, bool) + func NewClientConnectError(id UUID, err error) *ClientConnectError + func (e *ClientConnectError) Error() string + type ClientFactory struct + func NewClientFactory(options ClientOptions, uuidGenerator UUIDGenerator, ...) *ClientFactory + func (f *ClientFactory) Create() WebsocketClient + type ClientNotFoundError struct + ID UUID + func IsClientNotFoundError(err error) (*ClientNotFoundError, bool) + func NewClientNotFoundError(id UUID) *ClientNotFoundError + func (e *ClientNotFoundError) Error() string + type ClientOptions struct + DebugFuncTimeLimit time.Duration + IsDebug bool + PingInterval time.Duration + SendBufferSize int + func NewClientOptions() ClientOptions + type ClientPingError struct + Err error + ID UUID + Message Message + func IsClientPingError(err error) (*ClientPingError, bool) + func NewClientPingError(id UUID, message Message, err error) *ClientPingError + func (e *ClientPingError) Error() string + type ClientReceiveError struct + Err error + ID UUID + Message Message + func IsClientReceiveError(err error) (*ClientReceiveError, bool) + func NewClientReceiveError(id UUID, message Message, err error) *ClientReceiveError + func (e *ClientReceiveError) Error() string + type ClientRepeatConnectError struct + ID UUID + func IsClientRepeatConnectError(err error) (*ClientRepeatConnectError, bool) + func NewClientRepeatConnectError(id UUID) *ClientRepeatConnectError + func (e *ClientRepeatConnectError) Error() string + type ClientSendBufferOverflowError struct + ID UUID + func IsClientSendBufferOverflowError(err error) (*ClientSendBufferOverflowError, bool) + func NewClientSendBufferOverflowError(id UUID) *ClientSendBufferOverflowError + func (e *ClientSendBufferOverflowError) Error() string + type ClientSendError struct + Err error + ID UUID + Message Message + func IsClientSendError(err error) (*ClientSendError, bool) + func NewClientSendError(id UUID, message Message, err error) *ClientSendError + func (e *ClientSendError) Error() string + type ClientStore struct + func NewClientStore(options ClientStoreOptions, logger Logger) *ClientStore + func (s *ClientStore) Channels(clientID UUID) ([]string, error) + func (s *ClientStore) Count(channels ...string) int + func (s *ClientStore) CountChannels(clientID UUID) (int, error) + func (s *ClientStore) Find(fn IterateFunc, channels ...string) error + func (s *ClientStore) Get(clientID UUID) (WebsocketClient, error) + func (s *ClientStore) Set(client WebsocketClient) + func (s *ClientStore) SetChannels(clientID UUID, channels ...string) error + func (s *ClientStore) Unset(clientID UUID) error + func (s *ClientStore) UnsetChannels(clientID UUID, channels ...string) error + type ClientStoreOptions struct + ChannelShards struct{ ... } + ClientShards struct{ ... } + DebugFuncTimeLimit time.Duration + IsDebug bool + func NewClientStoreOptions() ClientStoreOptions + type ConnectHandler func(clientID UUID) + type ConnectionClosedError struct + Err error + func IsConnectionClosedError(err error) (*ConnectionClosedError, bool) + func NewConnectionClosedError(err error) *ConnectionClosedError + func (e *ConnectionClosedError) Error() string + type DisconnectHandler func(clientID UUID) + type ErrorHandler func(clientID UUID, err error) + type GobwasConnection struct + DebugFuncTimeLimit time.Duration + IsDebug bool + func (c *GobwasConnection) Close() error + func (c *GobwasConnection) Read() (Message, error) + func (c *GobwasConnection) Write(message Message) error + type GobwasConnectionUpgrader struct + func NewGobwasConnectionUpgrader(options GobwasConnectionUpgraderOptions, logger Logger) *GobwasConnectionUpgrader + func (u *GobwasConnectionUpgrader) Upgrade(w http.ResponseWriter, r *http.Request) (WebsocketConnection, error) + type GobwasConnectionUpgraderOptions struct + DebugFuncTimeLimit time.Duration + IsDebug bool + ReadTimout time.Duration + WriteTimout time.Duration + func NewGobwasConnectionUpgraderOptions() GobwasConnectionUpgraderOptions + type GorillaConnection struct + DebugFuncTimeLimit time.Duration + IsDebug bool + func (c *GorillaConnection) Close() error + func (c *GorillaConnection) Read() (Message, error) + func (c *GorillaConnection) Write(message Message) error + type GorillaConnectionUpgrader struct + func NewGorillaConnectionUpgrader(options GorillaConnectionUpgraderOptions, logger Logger) *GorillaConnectionUpgrader + func (u *GorillaConnectionUpgrader) Upgrade(w http.ResponseWriter, r *http.Request) (WebsocketConnection, error) + type GorillaConnectionUpgraderOptions struct + CheckOrigin func(r *http.Request) bool + DebugFuncTimeLimit time.Duration + EnableCompression bool + Error func(w http.ResponseWriter, r *http.Request, status int, reason error) + HandshakeTimeout time.Duration + IsDebug bool + MaxMessageSize int64 + ReadBufferSize int + ReadTimout time.Duration + Subprotocols []string + WriteBufferSize int + WriteTimout time.Duration + func NewGorillaConnectionUpgraderOptions() GorillaConnectionUpgraderOptions + type Hub struct + func NewDefaultHub() *Hub + func NewHub(options HubOptions, clientStore WebsocketClientStore, ...) *Hub + func (h *Hub) Channels(clientID UUID) ([]string, error) + func (h *Hub) Close() error + func (h *Hub) Count(channels ...string) int + func (h *Hub) Disconnect(clientID UUID) error + func (h *Hub) IsSubscribed(clientID UUID) bool + func (h *Hub) ListenAndServe(addr, path string) error + func (h *Hub) ListenAndServeTLS(addr, path, certFile, keyFile string) error + func (h *Hub) LogDebug(args ...interface{}) + func (h *Hub) LogDebugf(format string, args ...interface{}) + func (h *Hub) LogDebugln(args ...interface{}) + func (h *Hub) LogError(args ...interface{}) + func (h *Hub) LogErrorf(format string, args ...interface{}) + func (h *Hub) LogErrorln(args ...interface{}) + func (h *Hub) LogFatal(args ...interface{}) + func (h *Hub) LogFatalf(format string, args ...interface{}) + func (h *Hub) LogFatalln(args ...interface{}) + func (h *Hub) LogInfo(args ...interface{}) + func (h *Hub) LogInfof(format string, args ...interface{}) + func (h *Hub) LogInfoln(args ...interface{}) + func (h *Hub) LogPanic(args ...interface{}) + func (h *Hub) LogPanicf(format string, args ...interface{}) + func (h *Hub) LogPanicln(args ...interface{}) + func (h *Hub) LogPrint(args ...interface{}) + func (h *Hub) LogPrintf(format string, args ...interface{}) + func (h *Hub) LogPrintln(args ...interface{}) + func (h *Hub) LogWarn(args ...interface{}) + func (h *Hub) LogWarnf(format string, args ...interface{}) + func (h *Hub) LogWarnln(args ...interface{}) + func (h *Hub) OnConnect(handler ConnectHandler) + func (h *Hub) OnDisconnect(handler DisconnectHandler) + func (h *Hub) OnError(handler ErrorHandler) + func (h *Hub) OnReceive(handler ReceiveHandler) + func (h *Hub) Publish(message Message, channels ...string) (int, error) + func (h *Hub) Send(clientID UUID, message Message) error + func (h *Hub) ServeHTTP(response http.ResponseWriter, request *http.Request) + func (h *Hub) Subscribe(clientID UUID, channels ...string) error + func (h *Hub) Unsubscribe(clientID UUID, channels ...string) error + type HubOptions struct + DebugFuncTimeLimit time.Duration + IsDebug bool + ShutdownTimeout time.Duration + func NewHubOptions() HubOptions + type HubSubscriptionChannelRequired struct + func IsHubSubscriptionChannelRequiredError(err error) (*HubSubscriptionChannelRequired, bool) + func NewHubSubscriptionChannelRequiredError() *HubSubscriptionChannelRequired + func (e *HubSubscriptionChannelRequired) Error() string + type IterateFunc func(client WebsocketClient) error + type Logger interface + Debug func(args ...interface{}) + Debugf func(format string, args ...interface{}) + Debugln func(args ...interface{}) + Error func(args ...interface{}) + Errorf func(format string, args ...interface{}) + Errorln func(args ...interface{}) + Fatal func(args ...interface{}) + Fatalf func(format string, args ...interface{}) + Fatalln func(args ...interface{}) + Info func(args ...interface{}) + Infof func(format string, args ...interface{}) + Infoln func(args ...interface{}) + Panic func(args ...interface{}) + Panicf func(format string, args ...interface{}) + Panicln func(args ...interface{}) + Print func(args ...interface{}) + Printf func(format string, args ...interface{}) + Println func(args ...interface{}) + Warn func(args ...interface{}) + Warnf func(format string, args ...interface{}) + Warnln func(args ...interface{}) + type LogrusFormatter uint32 + const LogrusFormatterJSON + const LogrusFormatterText + type LogrusLevel uint32 + const LogrusLevelDebug + const LogrusLevelError + const LogrusLevelFatal + const LogrusLevelInfo + const LogrusLevelPanic + const LogrusLevelTrace + const LogrusLevelWarn + type LogrusLogger struct + func NewLogrusLogger(options LogrusLoggerOptions) *LogrusLogger + func (l LogrusLogger) Debug(args ...interface{}) + func (l LogrusLogger) Debugf(format string, args ...interface{}) + func (l LogrusLogger) Debugln(args ...interface{}) + func (l LogrusLogger) Error(args ...interface{}) + func (l LogrusLogger) Errorf(format string, args ...interface{}) + func (l LogrusLogger) Errorln(args ...interface{}) + func (l LogrusLogger) Fatal(args ...interface{}) + func (l LogrusLogger) Fatalf(format string, args ...interface{}) + func (l LogrusLogger) Fatalln(args ...interface{}) + func (l LogrusLogger) Info(args ...interface{}) + func (l LogrusLogger) Infof(format string, args ...interface{}) + func (l LogrusLogger) Infoln(args ...interface{}) + func (l LogrusLogger) Panic(args ...interface{}) + func (l LogrusLogger) Panicf(format string, args ...interface{}) + func (l LogrusLogger) Panicln(args ...interface{}) + func (l LogrusLogger) Print(args ...interface{}) + func (l LogrusLogger) Printf(format string, args ...interface{}) + func (l LogrusLogger) Println(args ...interface{}) + func (l LogrusLogger) Warn(args ...interface{}) + func (l LogrusLogger) Warnf(format string, args ...interface{}) + func (l LogrusLogger) Warnln(args ...interface{}) + type LogrusLoggerOptions struct + Formatter LogrusFormatter + Level LogrusLevel + Output io.Writer + func NewLogrusLoggerOptions() LogrusLoggerOptions + type Message struct + Payload []byte + Type MessageType + func NewBinaryMessage(payload []byte) Message + func NewBinaryMessageFromString(payload string) Message + func NewPingMessage() Message + func NewTextMessage(payload []byte) Message + func NewTextMessageFromString(payload string) Message + type MessageType byte + const MessageTypeBinary + const MessageTypePing + const MessageTypeText + type ReceiveHandler func(clientID UUID, message Message) + type SatoriUUIDGenerator struct + func (s SatoriUUIDGenerator) GenerateV4() UUID + type UUID [16]byte + func (u UUID) Bytes() []byte + func (u UUID) String() string + type UUIDGenerator interface + GenerateV4 func() UUID + type WebsocketClient interface + Close func() error + Connect func(response http.ResponseWriter, request *http.Request) error + ID func() UUID + OnError func(handler ErrorHandler) + OnReceive func(handler ReceiveHandler) + Send func(message Message) error + type WebsocketClientFactory interface + Create func() WebsocketClient + type WebsocketClientStore interface + Channels func(clientID UUID) ([]string, error) + Count func(channels ...string) int + CountChannels func(clientID UUID) (int, error) + Find func(fn IterateFunc, channels ...string) error + Get func(clientID UUID) (WebsocketClient, error) + Set func(client WebsocketClient) + SetChannels func(clientID UUID, channels ...string) error + Unset func(clientID UUID) error + UnsetChannels func(clientID UUID, channels ...string) error + type WebsocketConnection interface + Close func() error + Read func() (Message, error) + Write func(message Message) error + type WebsocketConnectionUpgrader interface + Upgrade func(w http.ResponseWriter, r *http.Request) (WebsocketConnection, error)