Versions in this module Expand all Collapse all v1 v1.0.0 May 11, 2024 Changes in this version + type Client struct + func (c *Client) AddHandlers(handlers ...Handler) + func (c *Client) AppID() string + func (c *Client) Cancel() context.CancelFunc + func (c *Client) Conn() *websocket.Conn + func (c *Client) ConnID() string + func (c *Client) ConnTime() time.Time + func (c *Client) Ctx() context.Context + func (c *Client) IsAlive() bool + func (c *Client) SendJSON(v any) error + func (c *Client) SendMsg(msgData []byte, msgType ...int) + func (c *Client) SetHandlers(handlers ...Handler) + func (c *Client) UserID() string + type Handler func(client *Client, msg *Msg) + type Manager struct + HeartbeatInterval time.Duration + MaxMessageSize int64 + ReadTimeout time.Duration + Upgrader *websocket.Upgrader + WriteTimeout time.Duration + func NewManager() *Manager + func (m *Manager) BroadcastMsg(msgData []byte, msgType ...int) + func (m *Manager) DelClient(connID string) + func (m *Manager) GetClient(connID string) (*Client, bool) + func (m *Manager) GetClients() []*Client + func (m *Manager) GetUserClient(userID, appID string) (*Client, bool) + func (m *Manager) GetUserClients(userID string) ([]*Client, bool) + func (m *Manager) SendMsgToClient(connID string, msgData []byte, msgType ...int) + func (m *Manager) SendMsgToUser(userID string, msgData []byte, msgType ...int) + func (m *Manager) UpgradeClient(w http.ResponseWriter, r *http.Request, opts ...Option) (*Client, error) + type Msg struct + Data []byte + Type int + type Option func(c *Client) + func WithAppID(appID string) Option + func WithChanSize(chanSize int) Option + func WithConnTime(connTime time.Time) Option + func WithHandlers(handlers ...Handler) Option + func WithUserID(userID string) Option