gf/net/ghttp/ghttp_server_websocket.go

38 lines
1.2 KiB
Go
Raw Normal View History

2021-01-17 21:46:25 +08:00
// 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"
2020-05-07 23:05:33 +08:00
// WebSocket wraps the underlying websocket connection
// and provides convenient functions.
type WebSocket struct {
2019-06-19 09:06:52 +08:00
*websocket.Conn
2018-08-31 23:53:57 +08:00
}
const (
2022-03-19 17:58:21 +08:00
// WsMsgText TextMessage denotes a text data message.
// The text message payload is interpreted as UTF-8 encoded text data.
2021-11-13 23:23:55 +08:00
WsMsgText = websocket.TextMessage
2019-06-19 09:06:52 +08:00
2021-11-13 23:23:55 +08:00
// WsMsgBinary BinaryMessage denotes a binary data message.
WsMsgBinary = websocket.BinaryMessage
2019-06-19 09:06:52 +08:00
2022-03-19 17:58:21 +08:00
// 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.
2021-11-13 23:23:55 +08:00
WsMsgClose = websocket.CloseMessage
2019-06-19 09:06:52 +08:00
2022-03-19 17:58:21 +08:00
// WsMsgPing PingMessage denotes a ping control message.
// The optional message payload is UTF-8 encoded text.
2021-11-13 23:23:55 +08:00
WsMsgPing = websocket.PingMessage
2019-06-19 09:06:52 +08:00
2022-03-19 17:58:21 +08:00
// WsMsgPong PongMessage denotes a pong control message.
// The optional message payload is UTF-8 encoded text.
2021-11-13 23:23:55 +08:00
WsMsgPong = websocket.PongMessage
2019-06-19 09:06:52 +08:00
)