| 87 | ) |
| 88 | |
| 89 | type Event interface { |
| 90 | // OnOpen 建立连接事件 |
| 91 | // WebSocket connection was successfully established |
| 92 | OnOpen(socket *Conn) |
| 93 | |
| 94 | // OnClose 关闭事件 |
| 95 | // 接收到了网络连接另一端发送的关闭帧, 或者IO过程中出现错误主动断开连接 |
| 96 | // 如果是前者, err可以断言为*CloseError |
| 97 | // Received a close frame from the other end of the network connection, or disconnected voluntarily due to an error in the IO process |
| 98 | // In the former case, err can be asserted as *CloseError |
| 99 | OnClose(socket *Conn, err error) |
| 100 | |
| 101 | // OnPing 心跳探测事件 |
| 102 | // Received a ping frame |
| 103 | OnPing(socket *Conn, payload []byte) |
| 104 | |
| 105 | // OnPong 心跳响应事件 |
| 106 | // Received a pong frame |
| 107 | OnPong(socket *Conn, payload []byte) |
| 108 | |
| 109 | // OnMessage 消息事件 |
| 110 | // 如果开启了ParallelEnabled, 会并行地调用OnMessage; 没有做recover处理. |
| 111 | // If ParallelEnabled is enabled, OnMessage is called in parallel. No recover is done. |
| 112 | OnMessage(socket *Conn, message *Message) |
| 113 | } |
| 114 | |
| 115 | type BuiltinEventHandler struct{} |
| 116 |
no outgoing calls
no test coverage detected