Versions in this module Expand all Collapse all v0 v0.1.0 Jan 3, 2025 Changes in this version + const Closed + const Connected + const Connecting + const Disconnected + const LobbySessionID + const Reconnecting + func DecodeWSMessage(msg string) map[string]interface + type ConnectionManager interface + Close func() error + Get func() *WSConnection + Save func(wsConnection *WSConnection) + type LobbyWebSocketClient struct + WSConn *WSConnection + func NewLobbyWebSocketClient(wsConn *WSConnection) *LobbyWebSocketClient + func (c *LobbyWebSocketClient) ClearData() + func (c *LobbyWebSocketClient) Close() error + func (c *LobbyWebSocketClient) Connect(reconnecting bool) (bool, error) + func (c *LobbyWebSocketClient) Get() *WSConnection + func (c *LobbyWebSocketClient) GetData(key string) interface{} + func (c *LobbyWebSocketClient) HasData(key string) bool + func (c *LobbyWebSocketClient) OnConnect(reconnecting bool) + func (c *LobbyWebSocketClient) OnDisconnect(code int32, reason string) + func (c *LobbyWebSocketClient) OnMessage(msg string) + func (c *LobbyWebSocketClient) ReadWSMessage(done chan struct{}, messageHandler func(message []byte)) + func (c *LobbyWebSocketClient) ReconnectDelay(numberOfAttempts int32) float32 + func (c *LobbyWebSocketClient) Save(conn *WSConnection) + func (c *LobbyWebSocketClient) Send(code int, message string) error + func (c *LobbyWebSocketClient) SetData(key string, value interface{}) + func (c *LobbyWebSocketClient) ShouldReconnect(code int, reason string, numberOfAttempts int) bool + func (c *LobbyWebSocketClient) WSHeartbeat(done chan struct{}) + type WSConnection struct + Conn *websocket.Conn + Data map[string]interface{} + EnableAutoReconnect bool + Header http.Header + MaxReconnectAttempts int + MessageHandler WSConnectionMessageHandler + Meta map[string]interface{} + Mu sync.RWMutex + MuStatus sync.RWMutex + StatusHandler WSConnectionStatusHandler + func NewWSConnection(configRepo repository.ConfigRepository, tokenRepo repository.TokenRepository, ...) (*WSConnection, error) + func NewWebsocketConnection(configRepo repository.ConfigRepository, tokenRepo repository.TokenRepository, ...) (*WSConnection, error) + func (c *WSConnection) Close(code int, reason string) error + func (c *WSConnection) DefaultCloseHandler(code int, reason string) error + func (c *WSConnection) DefaultPongHandler(text string) error + func (c *WSConnection) Dial(url string, headers http.Header) (*websocket.Conn, error) + func (c *WSConnection) GetData(key string) interface{} + func (c *WSConnection) GetStatus() string + func (c *WSConnection) Lock(location string) + func (c *WSConnection) SetStatus(status string) + func (c *WSConnection) Unlock(location string) + type WSConnectionMessageHandler func(msg []byte) + type WSConnectionOption func(wsConn *WSConnection) error + func WithEnableAutoReconnect() WSConnectionOption + func WithMaxReconnectAttempts(maxReconnectAttempts int) WSConnectionOption + func WithMessageHandler(handler WSConnectionMessageHandler) WSConnectionOption + func WithScheme(scheme string) WSConnectionOption + func WithStatusHandler(handler WSConnectionStatusHandler) WSConnectionOption + func WithToken(token string) WSConnectionOption + type WSConnectionStatusHandler func(status string) v0.1.0-alpha.7 Sep 6, 2024