Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GinWebsocketHandler ¶
func GinWebsocketHandler(recieveMessageFunc RecieveMessageFunc, shakeSuccessFunc ShakeSuccessFunc) func(c *gin.Context)
@title ws握手接口 @description 本质来说, WS服务在握手的过程中最开始也是HTTP请求, 然后再 Upgrade 到WS模式的,Upgrade函数接受三个参数, 一个是返回值套接字, 一个是请求套接字, 一个是返回值的头,而对于 Gin 的上下文 gin.Context 来说也是有这些数据的 @param recieveMessageFunc RecieveMessageFunc "服务端收到客户端发送的消息时的处理逻辑" @param shakeSuccessFunc ShakeSuccessFunc "客户端初次握手时的处理逻辑"
Types ¶
type RecieveMessageFunc ¶
type ShakeSuccessFunc ¶
握手成功后,需要进行的业务处理,入参为握手成功的websocket的id和用户上下文
Click to show internal directories.
Click to hide internal directories.