| Did you know ... | Search Documentation: |
| Pack logtalk -- logtalk-3.101.0/docs/handbook/_sources/libraries/http_websocket_messages.rst.txt |
.. _library_http_websocket_messages:
http_websocket_messages
This library provides the next transport-neutral WebSocket slice on top
of the http_websocket frame library. It reassembles continuation
sequences for text and binary messages, decodes and encodes UTF-8 text
payloads, and adds a normalized message term for text, binary, ping,
pong, and close messages.
This library can be used with backend Prolog systems that support unbound integer arithmetic.
Open the `../../apis/library_index.html#http_websocket_messages <../../apis/library_index.html#http_websocket_messages>`__ link in a web browser.
To load the library, load the loader.lgt file:
::
| ?- logtalk_load(http_websocket_messages(loader)).
To test this library, load the tester.lgt file:
::
| ?- logtalk_load(http_websocket_messages(tester)).
The current implementation provides:
This layer remains intentionally stateless. The
http_websocket_session library builds on top of it when the caller
needs explicit session state, interleaved control-frame surfacing, or
role-aware outgoing fragmentation and masking.
Messages use the normalized term:
::
message(Type, Payload)
Where:
Type is one of text, binary, ping, pong, or
close.text, Payload is text in the selected representation.binary, ping, and pong, Payload is a list of
bytes.close, Payload is one of:
emptystatus(Code)status(Code, Reason)
The parameterized object http_websocket_messages(TextRepresentation)
accepts atom, chars, or codes. The plain
http_websocket_messages object uses atoms.
http_client::open_websocket/4
or http_socket_transport::serve_websocket_once/5.http_socket_transport::connection_streams/3.http_websocket_session library when
fragmented data reads must coexist with interleaved control messages
or when writes should apply client or server masking policy
automatically.http_websocket predicates directly when you
need raw frame properties such as masking keys or reserved bits.http_websocket_session library when interleaved control messages
must be surfaced while the fragmented data remains pending.http_websocket_session library
when that policy should be applied automatically.http_websocket_session layer.