Documentation ¶
Index ¶
- Constants
- func BroadCastByte(data *[]byte, connList []*WebsocketConn) error
- func BroadCastString(data string, connList []*WebsocketConn) error
- func WebInit(config WebConfig) *http.Server
- type WebConfig
- type WebsocketCall
- type WebsocketConfig
- type WebsocketConn
- func (ws *WebsocketConn) Close(msg string, immediately bool)
- func (ws *WebsocketConn) GetBindVal() interface{}
- func (ws *WebsocketConn) GetDeadline(t time.Duration) time.Time
- func (ws *WebsocketConn) GetParm() WebsocketParm
- func (ws *WebsocketConn) SendByte(data *[]byte)
- func (ws *WebsocketConn) SendString(data string)
- type WebsocketParm
Constants ¶
View Source
const WebsocketCloseByServer = 4000
Variables ¶
This section is empty.
Functions ¶
func BroadCastString ¶
func BroadCastString(data string, connList []*WebsocketConn) error
广播String数据
Types ¶
type WebsocketCall ¶
type WebsocketCall struct { WebsocketConnect func(conn *WebsocketConn) (interface{}, error) WebsocketConnected func(conn *WebsocketConn) error WebsocketClosed func(conn *WebsocketConn, code int, text string) error WebsocketReceiver func(conn *WebsocketConn, data *[]byte) error WebsocketPong func(conn *WebsocketConn, pingData string) (string, error) WebsocketError func(text string, err error) }
Websocket接口配置
type WebsocketConfig ¶
type WebsocketConfig struct { WriteWaitTime time.Duration ReadWaitTime time.Duration PingWaitTime time.Duration PongWaitTime time.Duration Call WebsocketCall }
Websocket配置参数
func (*WebsocketConfig) WsHandle ¶
func (config *WebsocketConfig) WsHandle(c *gin.Context)
type WebsocketConn ¶
type WebsocketConn struct {
// contains filtered or unexported fields
}
Websocket连接
func (*WebsocketConn) GetDeadline ¶
func (ws *WebsocketConn) GetDeadline(t time.Duration) time.Time
设置读超时时间
type WebsocketParm ¶
Click to show internal directories.
Click to hide internal directories.