Documentation
¶
Index ¶
- Constants
- type BeforeCloseCallback
- type Client
- func (c *Client) CloseManually() error
- func (c *Client) GetId() string
- func (c *Client) GetToken() string
- func (c *Client) ReadMessage() (*protocol.Message, error)
- func (c *Client) SendMessageManually(msg *protocol.Message) error
- func (c *Client) StartMessageLoop(onClose BeforeCloseCallback) error
- func (c *Client) UpdateTimeout(deadline time.Time) error
- type ClientManager
- func (cm *ClientManager) AddClient(c *Client) error
- func (cm *ClientManager) Clear()
- func (cm *ClientManager) ListClients() []string
- func (cm *ClientManager) RemoveClient(c *Client)
- func (cm *ClientManager) SendToClient(id string, msg *protocol.Message) (bool, error)
- func (cm *ClientManager) SendToClientBatch(id string, msg utils.Iterable[*protocol.Message]) (bool, error)
- func (cm *ClientManager) SendToMultiClientBatch(v map[string]utils.Iterable[*protocol.Message]) (map[string]bool, error)
- func (cm *ClientManager) SendToMultiClientBatchContext(ctx context.Context, v map[string]utils.Iterable[*protocol.Message]) (map[string]bool, error)
- type IdTakenError
- type InvalidClientError
- type OneOrMoreMsg
- type TooManyClientsError
Constants ¶
View Source
const WriteWait = time.Second
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) CloseManually ¶
func (*Client) SendMessageManually ¶
func (*Client) StartMessageLoop ¶
func (c *Client) StartMessageLoop(onClose BeforeCloseCallback) error
type ClientManager ¶
type ClientManager struct {
MaxClients uint // Maximum number of clients
// contains filtered or unexported fields
}
ClientManager is responsible for handling all connected clients.
func NewClientManager ¶
func NewClientManager(maxClient uint) *ClientManager
func (*ClientManager) AddClient ¶
func (cm *ClientManager) AddClient(c *Client) error
func (*ClientManager) Clear ¶
func (cm *ClientManager) Clear()
func (*ClientManager) ListClients ¶
func (cm *ClientManager) ListClients() []string
func (*ClientManager) RemoveClient ¶
func (cm *ClientManager) RemoveClient(c *Client)
func (*ClientManager) SendToClient ¶
func (*ClientManager) SendToClientBatch ¶
func (*ClientManager) SendToMultiClientBatch ¶
type IdTakenError ¶
type IdTakenError struct {
}
func (IdTakenError) Error ¶
func (e IdTakenError) Error() string
type InvalidClientError ¶
type InvalidClientError struct {
}
func (InvalidClientError) Error ¶
func (e InvalidClientError) Error() string
type OneOrMoreMsg ¶
type TooManyClientsError ¶
type TooManyClientsError struct {
Count uint
}
func (TooManyClientsError) Error ¶
func (e TooManyClientsError) Error() string
Click to show internal directories.
Click to hide internal directories.