Documentation
¶
Index ¶
- type Client
- type ClientPool
- func (cp *ClientPool) ClientExitFromPool(clientId string)
- func (cp *ClientPool) DeleteClient(clientId string)
- func (cp *ClientPool) GetClient(clientId string) *Client
- func (cp *ClientPool) SendMessageToClient(clientId string, message Message)
- func (cp *ClientPool) SetClient(clientId string, client *Client)
- func (cp *ClientPool) Start() error
- type Message
- type ProcessedMessage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
Id string
Session *melody.Session
ClientPool *ClientPool
}
func NewClient ¶
func NewClient( clientId string, session *melody.Session, clientPool *ClientPool, ) *Client
func (*Client) HandleMessage ¶
func (*Client) Write ¶
func (c *Client) Write(message ProcessedMessage)
type ClientPool ¶
type ClientPool struct {
Register chan *Client
Unregister chan *Client
Clients map[string]*Client
// contains filtered or unexported fields
}
func NewClientPool ¶
func NewClientPool() *ClientPool
func (*ClientPool) ClientExitFromPool ¶
func (cp *ClientPool) ClientExitFromPool(clientId string)
func (*ClientPool) DeleteClient ¶
func (cp *ClientPool) DeleteClient(clientId string)
func (*ClientPool) GetClient ¶
func (cp *ClientPool) GetClient(clientId string) *Client
func (*ClientPool) SendMessageToClient ¶
func (cp *ClientPool) SendMessageToClient(clientId string, message Message)
func (*ClientPool) SetClient ¶
func (cp *ClientPool) SetClient(clientId string, client *Client)
func (*ClientPool) Start ¶
func (cp *ClientPool) Start() error
type Message ¶
type Message struct {
Id string `json:"id" mapstructure:"id"`
SendTo []string `json:"send_to" mapstructure:"send_to"`
Type string `json:"type" mapstructure:"type"`
Timestamp time.Time `json:"timestamp" mapstructure:"timestamp"`
Payload map[string]interface{} `json:"payload" mapstructure:"payload"`
}
Click to show internal directories.
Click to hide internal directories.