connectionm

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DATA_CHAN_MAX_LEN = 1024 // 每个连接通道最多缓存1024条消息
)

Variables

This section is empty.

Functions

func ConnectionManagerInit

func ConnectionManagerInit()

Types

type AppConnection

type AppConnection struct {
	Connections cmap.ConcurrentMap
}

type Connection

type Connection struct {
	// ReadPackNum   uint64
	// WritePackNum  uint64
	Conn          *websocket.Conn
	WsConnectInfo *proto.WsConnectInfo
	DataCh        chan []byte
}

type ConnectionManager

type ConnectionManager struct {
	Mutex         *sync.Mutex
	LastEnterTime int64 // 最后入场时间

	ConnectionMap cmap.ConcurrentMap // 按客户端
	LiveMap       cmap.ConcurrentMap // 按房间分组
	AppMap        cmap.ConcurrentMap // 按渠道分组
}

func GetConnectionManager

func GetConnectionManager() *ConnectionManager

func (*ConnectionManager) ClearConnection

func (c *ConnectionManager) ClearConnection(connection *Connection)

func (*ConnectionManager) DeleteAppMap

func (c *ConnectionManager) DeleteAppMap(sessionID, appID string)

func (*ConnectionManager) DeleteConnection

func (c *ConnectionManager) DeleteConnection(sessionID string)

func (*ConnectionManager) DeleteLiveMap

func (c *ConnectionManager) DeleteLiveMap(sessionID, liveID string)

func (*ConnectionManager) GetAppConnection

func (c *ConnectionManager) GetAppConnection(appID string) *AppConnection

func (*ConnectionManager) GetConnection

func (c *ConnectionManager) GetConnection(sessionID string) *Connection

func (*ConnectionManager) GetRommConnection

func (c *ConnectionManager) GetRommConnection(liveID string) *RoomConnection

func (*ConnectionManager) NewConnection

func (c *ConnectionManager) NewConnection(con *websocket.Conn, wsConnInfo *proto.WsConnectInfo) *Connection

type RoomConnection

type RoomConnection struct {
	Connections cmap.ConcurrentMap
}

Jump to

Keyboard shortcuts

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