.. index:: single: http_websocket_service_handler_protocol
.. _http_websocket_service_handler_protocol/0:

.. rst-class:: right

**protocol**

``http_websocket_service_handler_protocol``
===========================================

Protocol for callback objects used by the callback-driven WebSocket service loops.

| **Availability:** 
|    ``logtalk_load(http_websocket_service(loader))``

| **Author:** Paulo Moura
| **Version:** 1:0:0
| **Date:** 2026-06-26

| **Compilation flags:**
|    ``static``


| **Dependencies:**
|   (none)


| **Remarks:**
|    (none)

| **Inherited public predicates:**
|    (none)

.. contents::
   :local:
   :backlinks: top

Public predicates
-----------------

.. index:: handle/2
.. _http_websocket_service_handler_protocol/0::handle/2:

``handle/2``
^^^^^^^^^^^^

Processes a received normalized WebSocket message and returns a list of zero or more session actions. Plain normalized messages are written back on the same session before the next read. When used with the registry-backed server helper, the list may also contain the action wrappers ``reply(Message)``, ``broadcast(Message)``, and ``broadcast_others(Message)``.

| **Compilation flags:**
|    ``static``

| **Template:**
|    ``handle(Message,Replies)``
| **Mode and number of proofs:**
|    ``handle(+compound,-list(compound))`` - ``one_or_error``

| **Exceptions:**
|    ``Message`` is not a valid normalized WebSocket message term:
|        ``domain_error(http_websocket_message,Message)``
|    ``Replies`` is a variable:
|        ``instantiation_error``
|    ``Replies`` is neither a variable nor a list:
|        ``type_error(list,Replies)``
|    An element ``Reply`` of the list ``Replies`` is not a valid reply message:
|        ``domain_error(http_websocket_service_handler_reply,Reply)``
|    An element ``Reply`` of the list ``Replies`` is not a valid registry-backed action:
|        ``domain_error(http_websocket_service_handler_action,Reply)``


------------

Protected predicates
--------------------

(none)

Private predicates
------------------

(none)

Operators
---------

(none)

