clients

package
v0.0.0-...-22a6110 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2025 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

Deregister client and unbind socket.

func (*ClientPool) Idle

func (cp *ClientPool) Idle(cid string)

Cache or refresh unix nanosecond time as weight.

func (*ClientPool) Idles

func (cp *ClientPool) Idles() []string

Return idle clients ids

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.

Jump to

Keyboard shortcuts

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