All Classes Namespaces Functions Variables Groups Pages
WebSocketUtil.qm.dox.h
// -*- mode: c++; indent-tabs-mode: nil -*-
/* WebSocketUtil.qm Copyright 2013 - 2017 Qore Technologies, s.r.o.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
// minimum required Qore version
// require type definitions everywhere
// enable all warnings
// assume local var scope, do not use "$" for vars, members, and method calls
namespace WebSocketUtil {
const WS_GUID = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
const WS_FIN = (1 << 7);
const WSOP_Continuation = 0x0;
const WSOP_Text = 0x1;
const WSOP_Binary = 0x2;
const WSOP_Close = 0x8;
const WSOP_Ping = 0x9;
const WSOP_Pong = 0xa;
const WSOPMap = (
WSOP_Continuation: "CONTINUATION",
WSOP_Text: "TEXT",
WSOP_Binary: "BINARY",
WSOP_Close: "CLOSE",
WSOP_Ping: "PING",
WSOP_Pong: "PONG",
);
const WSCC_NormalClosure = 1000;
const WSCC_GoingAway = 1001;
const WSCC_ProtocolError = 1002;
const WSCC_UnsupportedData = 1003;
const WSCC_NoStatusRcvd = 1005;
const WSCC_AbnormalClosure = 1006;
const WSCC_InvalidData = 1007;
const WSCC_PolicyViolation = 1008;
const WSCC_MessageTooBig = 1009;
const WSCC_MandatoryExt = 1010;
const WSCC_InternalServerError = 1011;
const WSCC_TlsHandshake = 1015;
const WSCCMap = (
WSCC_NormalClosure: "Normal Closure",
WSCC_GoingAway: "Going Away",
WSCC_ProtocolError: "Protocol Error",
WSCC_UnsupportedData: "Unsupported Data",
WSCC_NoStatusRcvd: "No Status Rcvd",
WSCC_AbnormalClosure: "Abnormal Closure",
WSCC_InvalidData: "Invalid Frame Payload Data",
WSCC_PolicyViolation: "Policy Violation",
WSCC_MessageTooBig: "Message Too Big",
WSCC_MandatoryExt: "Mandatory Ext.",
WSCC_InternalServerError: "Internal Server Error",
WSCC_TlsHandshake: "TLS Handshake",
);
binary ws_encode_message(data msg, int op = -1, *bool masked);
hash ws_read_message(Socket sock, *timeout to);
string ws_get_response_key(string key);
};
WebSocketUtil::WSCC_GoingAway
const WSCC_GoingAway
&quot;Going Away&quot; code
Definition: WebSocketUtil.qm.dox.h:120
WebSocketUtil::WSOPMap
const WSOPMap
maps from opcodes to text descriptions
Definition: WebSocketUtil.qm.dox.h:103
WebSocketUtil::WSOP_Continuation
const WSOP_Continuation
continuation frame opcode
Definition: WebSocketUtil.qm.dox.h:85
binary
binary binary()
WebSocketUtil::WSOP_Close
const WSOP_Close
connection code opcode
Definition: WebSocketUtil.qm.dox.h:94
WebSocketUtil::WSOP_Pong
const WSOP_Pong
pong opcode
Definition: WebSocketUtil.qm.dox.h:100
WebSocketUtil::WSCC_NoStatusRcvd
const WSCC_NoStatusRcvd
&quot;No Status Rcvd&quot; code
Definition: WebSocketUtil.qm.dox.h:129
WebSocketUtil::WSCC_MandatoryExt
const WSCC_MandatoryExt
&quot;Mandatory Ext.&quot; code
Definition: WebSocketUtil.qm.dox.h:144
WebSocketUtil::WSCC_UnsupportedData
const WSCC_UnsupportedData
&quot;Unsupported Data&quot; code
Definition: WebSocketUtil.qm.dox.h:126
WebSocketUtil::WSCC_ProtocolError
const WSCC_ProtocolError
&quot;Protocol Error&quot; code
Definition: WebSocketUtil.qm.dox.h:123
WebSocketUtil::WS_GUID
const WS_GUID
WebSocket GUID.
Definition: WebSocketUtil.qm.dox.h:76
WebSocketUtil::ws_get_response_key
string ws_get_response_key(string key)
returns a string response key from the binary key and the WebSocket GUID value
WebSocketUtil::WSCC_InvalidData
const WSCC_InvalidData
&quot;Invalid Frame Payload Data&quot; code
Definition: WebSocketUtil.qm.dox.h:135
WebSocketUtil::WSCCMap
const WSCCMap
maps from close codes to text descriptions
Definition: WebSocketUtil.qm.dox.h:153
WebSocketUtil::ws_read_message
hash ws_read_message(Socket sock, *timeout to)
read and decode a message from a socket
WebSocketUtil::WSOP_Binary
const WSOP_Binary
binary frame opcode
Definition: WebSocketUtil.qm.dox.h:91
WebSocketUtil::WSCC_MessageTooBig
const WSCC_MessageTooBig
&quot;Message Too Big&quot; code
Definition: WebSocketUtil.qm.dox.h:141
WebSocketUtil::WSOP_Ping
const WSOP_Ping
ping opcode
Definition: WebSocketUtil.qm.dox.h:97
WebSocketUtil::ws_encode_message
binary ws_encode_message(data msg, int op=-1, *bool masked)
encodes a message for sending over a websocket socket
WebSocketUtil::WSOP_Text
const WSOP_Text
text frame opcode
Definition: WebSocketUtil.qm.dox.h:88
WebSocketUtil::WSCC_InternalServerError
const WSCC_InternalServerError
&quot;Internal Server Error&quot; code
Definition: WebSocketUtil.qm.dox.h:147
WebSocketUtil::WSCC_TlsHandshake
const WSCC_TlsHandshake
&quot;TLS Handshake&quot; code
Definition: WebSocketUtil.qm.dox.h:150
WebSocketUtil::WSCC_AbnormalClosure
const WSCC_AbnormalClosure
&quot;Abnormal Closure&quot; code
Definition: WebSocketUtil.qm.dox.h:132
WebSocketUtil::WSCC_NormalClosure
const WSCC_NormalClosure
&quot;Normal Closure&quot; code
Definition: WebSocketUtil.qm.dox.h:117
hash
hash hash(object obj)
WebSocketUtil::WS_FIN
const WS_FIN
the final fragment in a message
Definition: WebSocketUtil.qm.dox.h:79
WebSocketUtil::WSCC_PolicyViolation
const WSCC_PolicyViolation
&quot;Policy Violation&quot; code
Definition: WebSocketUtil.qm.dox.h:138