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
- func (cp *ClientPool) Idle(cid string)
- func (cp *ClientPool) Idles() []string
- func (cp *ClientPool) IsExist(cid string) bool
- func (cp *ClientPool) LeaveIdle(cid string)
- func (cp *ClientPool) Option(cid string) string
- func (cp *ClientPool) Register(sc sio.Socket, cid, opt string) error
- func (cp *ClientPool) SetOption(cid, opt string) error
- func (cp *ClientPool) Signaling(cid, evt, data string) error
- func (cp *ClientPool) SortIdels() []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
Deregister client and unbind socket.
func (*ClientPool) Idle ¶
func (cp *ClientPool) Idle(cid string)
Cache or refresh unix nanosecond time as weight.
func (*ClientPool) IsExist ¶
func (cp *ClientPool) IsExist(cid string) bool
Check the client if exist.
func (*ClientPool) LeaveIdle ¶
func (cp *ClientPool) LeaveIdle(cid string)
Remove client out of idles 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) Register ¶
func (cp *ClientPool) Register(sc sio.Socket, cid, opt string) error
Register client and bind socket.
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) SortIdels ¶
func (cp *ClientPool) SortIdels() []string
Move client out of idle state without acquiring the lock.
Click to show internal directories.
Click to hide internal directories.