Documentation ¶
Index ¶
- type ClientPool
- func (cp *ClientPool) Client(cid string) *client
- func (cp *ClientPool) ClientID(sid string) string
- func (cp *ClientPool) Counts() map[string]int
- func (cp *ClientPool) Deregister(sc sio.Socket) (string, string)
- func (cp *ClientPool) IdleClients() []string
- func (cp *ClientPool) IsExist(cid string) bool
- func (cp *ClientPool) LeaveWaiting(cid string)
- func (cp *ClientPool) Option(cid string) string
- func (cp *ClientPool) Register(cid string, sc sio.Socket, opt string) error
- func (cp *ClientPool) SetOption(cid, opt string) error
- func (cp *ClientPool) Signaling(cid, evt, data string) error
- func (cp *ClientPool) SortWaitings() []string
- func (cp *ClientPool) Waiting(cid string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientPool ¶
type ClientPool struct {
// contains filtered or unexported fields
}
ClientPool client pool
func (*ClientPool) Client ¶
func (cp *ClientPool) Client(cid string) *client
Return client, it maybe nil if unexist.
func (*ClientPool) ClientID ¶
func (cp *ClientPool) ClientID(sid string) string
Return client id from socket id.
func (*ClientPool) Counts ¶
func (cp *ClientPool) Counts() map[string]int
Count clients by option key, it not count the empty option clients.
func (*ClientPool) Deregister ¶
func (cp *ClientPool) Deregister(sc sio.Socket) (string, string)
Deregister client and unbind socket.
func (*ClientPool) IdleClients ¶
func (cp *ClientPool) IdleClients() []string
Return waiting clients ids
func (*ClientPool) IsExist ¶
func (cp *ClientPool) IsExist(cid string) bool
Check the client if exist.
func (*ClientPool) LeaveWaiting ¶
func (cp *ClientPool) LeaveWaiting(cid string)
Remove client out of waiting map whatever weight value over zero or not.
func (*ClientPool) Option ¶
func (cp *ClientPool) Option(cid string) string
Return client optinal data, it maybe nil.
func (*ClientPool) SetOption ¶
func (cp *ClientPool) SetOption(cid, opt string) error
Set the client optinal data, maybe return error if not exist client.
func (*ClientPool) Signaling ¶
func (cp *ClientPool) Signaling(cid, evt, data string) error
Send signaling with message to indicate client.
func (*ClientPool) SortWaitings ¶
func (cp *ClientPool) SortWaitings() []string
Move client out of waiting state without acquiring the lock.
func (*ClientPool) Waiting ¶
func (cp *ClientPool) Waiting(cid string)
Cache or refresh waiting unix nanosecond time as weight.
Click to show internal directories.
Click to hide internal directories.