- OpCode of the message. This is an atom for known opcodes and
an integer for unknown ones. If the peer closed the stream, OpCode
is bound to
closeand data to the atom
- The data, represented as a string. This field is always present. String is the empty string if there is no data in the message.
- Present if the WebSocket RSV header is not 0. RSV is an integer in the range [1..7].
ping message is received and WebSocket is
a stream pair,
ws_receive/1 replies with a
and waits for the next message.
The predicate ws_receive/3 processes the following options:
- Defines how text messages are parsed. Format is one of
- Data is returned as a Prolog string (default)
- Data is parsed using json_read_dict/3, which also receives Options.
- Data is parsed using read_term/3, which also receives Options.
- To be done
- Add a hook to allow for more data formats?