ReceiveWebSocket (Socket function)

From m204wiki
Revision as of 17:20, 13 August 2019 by Tom (talk | contribs) (→‎Usage notes)
Jump to navigation Jump to search

Receive Web Socket framed message (Socket class)

[Introduced in Model 204 7.8 βeta]


This page is under construction.

Syntax

%opCode = socket:ReceiveWebSocket( string)

Syntax terms

%opCode op code is a number indicating the type of web socket frame received. Numbers 0-7 are non-control frames. Numbers 8-15 are control frames.
0 A continuation frame. A continuation frame is treated as text or binary based on the op code of the first frame.
1 A text frame. Text frames are are translated to ASCII with the translate table in effect for the port.
2 A binary frame. No translation is done for binary frames.
3-7 Reserved for future use.
8 Connection close frame. A close frame should be sent in response.
9 Ping. The receiver should respond with a Pong frame, unless a close frame has been received.
10 Pong. This is sent as a response to a Ping frame.
11-15 Reserved for future use.
128 This value is added to the frame op code to indicate the final fragment of a non-control message. The first fragment may also be the final fragment.
socket Socket object
string string

Usage notes

Received data may be masked by the sender. Masked data is always unmasked using the sender's masking key before it is returned to the application.

Examples

See also