/
ghttp_server_websocket.go
37 lines (29 loc) · 1.23 KB
/
ghttp_server_websocket.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
//
// This Source Code Form is subject to the terms of the MIT License.
// If a copy of the MIT was not distributed with this file,
// You can obtain one at https://github.com/gogf/gf.
package ghttp
import "github.com/gorilla/websocket"
// WebSocket wraps the underlying websocket connection
// and provides convenient functions.
type WebSocket struct {
*websocket.Conn
}
const (
// WsMsgText TextMessage denotes a text data message.
// The text message payload is interpreted as UTF-8 encoded text data.
WsMsgText = websocket.TextMessage
// WsMsgBinary BinaryMessage denotes a binary data message.
WsMsgBinary = websocket.BinaryMessage
// WsMsgClose CloseMessage denotes a close control message.
// The optional message payload contains a numeric code and text.
// Use the FormatCloseMessage function to format a close message payload.
WsMsgClose = websocket.CloseMessage
// WsMsgPing PingMessage denotes a ping control message.
// The optional message payload is UTF-8 encoded text.
WsMsgPing = websocket.PingMessage
// WsMsgPong PongMessage denotes a pong control message.
// The optional message payload is UTF-8 encoded text.
WsMsgPong = websocket.PongMessage
)