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