- 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 json_write_dict/2.
- 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
opcodekey. Other keys used are:
- Serialization format used for Message.data. Format
is one of
json. See ws_receive/3.
- 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 properly serialized.
- To be done
- Provide serialization details using options.