Qore WebSocketUtil Module Reference
1.4.1
|
the WebSocketUtil namespace contains all the definitions in the WebSocketUtil module More...
Classes | |
hashdecl | WsMsgInfo |
WebSocket message info. More... | |
Functions | |
binary | ws_encode_message (data msg, int op=-1, *bool masked, bool fin=True) |
encodes a message for sending over a websocket socket | |
string | ws_get_response_key (string key) |
returns a string response key from the binary key and the WebSocket GUID value More... | |
hash< WsMsgInfo > | ws_read_message (Socket sock, *timeout to) |
read and decode a message from a socket More... | |
Variables | |
const | WS_FIN = (1 << 7) |
the final fragment in a message | |
const | WS_GUID = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11" |
WebSocket GUID. | |
const | WSCC_AbnormalClosure = 1006 |
"Abnormal Closure" code | |
const | WSCC_GoingAway = 1001 |
"Going Away" code | |
const | WSCC_InternalServerError = 1011 |
"Internal Server Error" code | |
const | WSCC_InvalidData = 1007 |
"Invalid Frame Payload Data" code | |
const | WSCC_MandatoryExt = 1010 |
"Mandatory Ext." code | |
const | WSCC_MessageTooBig = 1009 |
"Message Too Big" code | |
const | WSCC_NormalClosure = 1000 |
"Normal Closure" code | |
const | WSCC_NoStatusRcvd = 1005 |
"No Status Rcvd" code | |
const | WSCC_PolicyViolation = 1008 |
"Policy Violation" code | |
const | WSCC_ProtocolError = 1002 |
"Protocol Error" code | |
const | WSCC_TlsHandshake = 1015 |
"TLS Handshake" code | |
const | WSCC_UnsupportedData = 1003 |
"Unsupported Data" code | |
const | WSCCMap = ... |
maps from close codes to text descriptions | |
const | WSOP_Binary = 0x2 |
binary frame opcode | |
const | WSOP_Close = 0x8 |
connection code opcode | |
const | WSOP_Continuation = 0x0 |
continuation frame opcode | |
const | WSOP_Ping = 0x9 |
ping opcode | |
const | WSOP_Pong = 0xa |
pong opcode | |
const | WSOP_Text = 0x1 |
text frame opcode | |
const | WSOPMap = ... |
maps from opcodes to text descriptions | |
the WebSocketUtil namespace contains all the definitions in the WebSocketUtil module
returns a string response key from the binary key and the WebSocket GUID value
key | the base64-encoded key received in the Sec-WebSocket-Key header |
Sec-WebSocket-Accept
headerread and decode a message from a socket
sock | the Socket object to receive the message |
to | an optional read timeout |
op:
the operation code (one of WebSocket OpCodes)masked
a boolean flag indicating if the message was masked or notmsg:
the message received; if a CLOSE opcode is received (see WSOP_Close) then any close message is decoded and included here in text formclose:
the close code (one of WebSocket Close Codes); only included if op is WSOP_Close