Documentation ¶
Index ¶
- Variables
- type BroadcastMessage
- type ClientMessage
- type Handler
- type Pool
- func (p *Pool) Broadcast(msg []byte)
- func (p *Pool) Close() error
- func (p *Pool) Count() int
- func (p *Pool) Register(id string, r *http.Request, w http.ResponseWriter) error
- func (p *Pool) RegisterHandler(h Handler)
- func (p *Pool) Send(clientId string, msg []byte)
- func (p *Pool) Unregister(id string) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrPoolIsFull = fmt.Errorf("pool is full") ErrClientNotFound = fmt.Errorf("client not found") )
Functions ¶
This section is empty.
Types ¶
type BroadcastMessage ¶
type BroadcastMessage struct {
Payload []byte `json:"payload"`
}
func NewBroadcastMessage ¶
func NewBroadcastMessage(payload []byte) BroadcastMessage
type ClientMessage ¶
func NewClientMessage ¶
func NewClientMessage(clientId string, payload []byte) ClientMessage
type Handler ¶
type Handler func(msg ClientMessage)
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
func (*Pool) RegisterHandler ¶
func (*Pool) Unregister ¶
Click to show internal directories.
Click to hide internal directories.