clients

package
v0.0.0-...-5049426 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

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 Clients

func Clients() *ClientPool

Return ClientPool singleton

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) Register

func (cp *ClientPool) Register(cid string, sc sio.Socket, 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) 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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL