github.com/gogf/gf@v1.16.9/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/gogf/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 // TextMessage denotes a text data message. The text message payload is 19 // interpreted as UTF-8 encoded text data. 20 WS_MSG_TEXT = websocket.TextMessage 21 22 // BinaryMessage denotes a binary data message. 23 WS_MSG_BINARY = websocket.BinaryMessage 24 25 // CloseMessage denotes a close control message. The optional message 26 // payload contains a numeric code and text. Use the FormatCloseMessage 27 // function to format a close message payload. 28 WS_MSG_CLOSE = websocket.CloseMessage 29 30 // PingMessage denotes a ping control message. The optional message payload 31 // is UTF-8 encoded text. 32 WS_MSG_PING = websocket.PingMessage 33 34 // PongMessage denotes a pong control message. The optional message payload 35 // is UTF-8 encoded text. 36 WS_MSG_PONG = websocket.PongMessage 37 )