+Message)Send a message over a websocket. The following terms are allowed for Message:
- Send a text message. Text is serialized using write/1.
text(+Text), but all character codes produced by Content
must be in the range [0..255]. Typically, Content will be an
atom or string holding binary data.
- Send a Prolog term as a text message. Text is serialized using write_canonical/1.
- Send the Prolog representation of a JSON term using
- Same as
text(+Text), provided for consistency.
- close(+Code, +Text)
- Send a close message. Code is 1000 for normal close. See
websocket documentation for other values.
- A dict that minimally contains an
opcode key. Other keys
- Serialization format used for Message.data. Format
is one of
- If this key is present, it is serialized according to Message.format.
Otherwise it is serialized using
write/1, which implies that string and
atoms are just sent verbatim.
Note that ws_start_message/3 does not
unlock the stream. This is done by ws_send/1.
This implies that multiple threads can use
ws_send/2 and the messages are
- To be done
- Provide serialization details using options.