Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Accept ¶
onConnect func(conn Connection), onReceive func(conn Connection, buffer []byte), onClose func(conn Connection) 封装tcp连接池管理
func Connect ¶
func Connect(conn Connection, onConnect func(conn Connection), onReceive func(conn Connection, buffer []byte), onClose func(conn Connection))
新连接
Types ¶
type Client ¶
type Client struct { Conn []Connection Count uint32 //连接数量 // contains filtered or unexported fields }
客户端连接池
var Clients Client
type Connection ¶
type Connection struct { Fd uint32 Addr string Socket net.Conn // 底层websocket // contains filtered or unexported fields }
Tcp连接
type Event ¶
type Event struct { OnConnect func(conn Connection) OnReceive func(conn Connection, buffer []byte) OnClose func(conn Connection) }
Click to show internal directories.
Click to hide internal directories.