Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
Connection websocket 链接
func InitSocket ¶
func InitSocket(ctx context.Context, w http.ResponseWriter, r *http.Request) (*Connection, error)
func (*Connection) WebsocketClose ¶
func (c *Connection) WebsocketClose()
WebsocketClose 关闭 websocket 通道
func (*Connection) WebsocketRead ¶
func (c *Connection) WebsocketRead() (*Message, error)
WebsocketRead 从前端读消息
func (*Connection) WebsocketWrite ¶
func (c *Connection) WebsocketWrite(msgType int, data []byte) error
WebsocketWrite 写消息到前端
Click to show internal directories.
Click to hide internal directories.