object

http_websocket_service_registry

Session registry predicates for active WebSocket sessions and queued broadcast delivery.

Availability:
logtalk_load(http_websocket_service(loader))
Author: Paulo Moura
Version: 1:0:0
Date: 2026-06-26
Compilation flags:
static, context_switching_calls
Remarks:
(none)
Inherited public predicates:
(none)

Public predicates

open/1

Opens a new empty WebSocket session registry.

Compilation flags:
static
Template:
open(Registry)
Mode and number of proofs:
open(-compound) - one

close/1

Closes a session registry and removes all registered sessions and queued messages.

Compilation flags:
static
Template:
close(Registry)
Mode and number of proofs:
close(+compound) - one_or_error
Exceptions:
Registry is a variable:
instantiation_error
Registry is neither a variable nor an open WebSocket service registry handle:
domain_error(http_websocket_service_registry,Registry)
Registry refers to a closed WebSocket service registry handle:
existence_error(http_websocket_service_registry,session_registry(RegistryId))

register/2

Registers a new active session in the given registry and returns its session identifier.

Compilation flags:
static
Template:
register(Registry,Session)
Mode and number of proofs:
register(+compound,-compound) - one_or_error
Exceptions:
Registry is a variable:
instantiation_error
Registry is neither a variable nor an open WebSocket service registry handle:
domain_error(http_websocket_service_registry,Registry)
Registry refers to a closed WebSocket service registry handle:
existence_error(http_websocket_service_registry,session_registry(RegistryId))

unregister/2

Removes a session from the given registry together with any queued outbound messages.

Compilation flags:
static
Template:
unregister(Registry,Session)
Mode and number of proofs:
unregister(+compound,+compound) - one_or_error
Exceptions:
Registry is a variable:
instantiation_error
Registry is neither a variable nor an open WebSocket service registry handle:
domain_error(http_websocket_service_registry,Registry)
Registry refers to a closed WebSocket service registry handle:
existence_error(http_websocket_service_registry,session_registry(RegistryId))
Session is a variable or is not a session for Registry:
instantiation_error
Session is not a valid WebSocket service registry session handle:
domain_error(http_websocket_service_registry_session,Session)
Session is not registered in Registry:
existence_error(http_websocket_service_registry_session,websocket_session(RegistryId,SessionId))

session/2

Enumerates active session identifiers registered in the given registry.

Compilation flags:
static
Template:
session(Registry,Session)
Mode and number of proofs:
session(+compound,?compound) - zero_or_more

sessions/2

Returns the list of active session identifiers registered in the given registry.

Compilation flags:
static
Template:
sessions(Registry,Sessions)
Mode and number of proofs:
sessions(+compound,-list(compound)) - one_or_error
Exceptions:
Registry is a variable:
instantiation_error
Registry is neither a variable nor an open WebSocket service registry handle:
domain_error(http_websocket_service_registry,Registry)
Registry refers to a closed WebSocket service registry handle:
existence_error(http_websocket_service_registry,session_registry(RegistryId))

session_count/2

Returns the number of active sessions currently registered in the given registry.

Compilation flags:
static
Template:
session_count(Registry,Count)
Mode and number of proofs:
session_count(+compound,-integer) - one_or_error
Exceptions:
Registry is a variable:
instantiation_error
Registry is neither a variable nor an open WebSocket service registry handle:
domain_error(http_websocket_service_registry,Registry)
Registry refers to a closed WebSocket service registry handle:
existence_error(http_websocket_service_registry,session_registry(RegistryId))

send/3

Queues a normalized outbound message for the specified registered session.

Compilation flags:
static
Template:
send(Registry,Session,Message)
Mode and number of proofs:
send(+compound,+compound,+compound) - one_or_error
Exceptions:
Registry is not an open WebSocket service registry handle:
domain_error(http_websocket_service_registry,Registry)
Session is not a valid WebSocket service registry session handle:
domain_error(http_websocket_service_registry_session,Session)
Session is not registered in Registry:
existence_error(http_websocket_service_registry_session,websocket_session(RegistryId,SessionId))
Message is not a valid normalized WebSocket message term:
domain_error(http_websocket_service_registry_message,Message)

broadcast/2

Queues a normalized outbound message for all currently registered sessions.

Compilation flags:
static
Template:
broadcast(Registry,Message)
Mode and number of proofs:
broadcast(+compound,+compound) - one_or_error
Exceptions:
Registry is not an open WebSocket service registry handle:
domain_error(http_websocket_service_registry,Registry)
Message is not a valid normalized WebSocket message term:
domain_error(http_websocket_service_registry_message,Message)

broadcast_except/3

Queues a normalized outbound message for all currently registered sessions except the specified session.

Compilation flags:
static
Template:
broadcast_except(Registry,Session,Message)
Mode and number of proofs:
broadcast_except(+compound,+compound,+compound) - one_or_error
Exceptions:
Registry is not an open WebSocket service registry handle:
domain_error(http_websocket_service_registry,Registry)
Session is not a valid WebSocket service registry session handle:
domain_error(http_websocket_service_registry_session,Session)
Session is not registered in Registry:
existence_error(http_websocket_service_registry_session,websocket_session(RegistryId,SessionId))
Message is not a valid normalized WebSocket message term:
domain_error(http_websocket_service_registry_message,Message)

take_pending/3

Removes and returns the queued outbound messages for the specified registered session.

Compilation flags:
static
Template:
take_pending(Registry,Session,Messages)
Mode and number of proofs:
take_pending(+compound,+compound,-list(compound)) - one_or_error
Exceptions:
Registry is not an open WebSocket service registry handle:
domain_error(http_websocket_service_registry,Registry)
Session is not a valid WebSocket service registry session handle:
domain_error(http_websocket_service_registry_session,Session)
Session is not registered in Registry:
existence_error(http_websocket_service_registry_session,websocket_session(RegistryId,SessionId))

Protected predicates

(no local declarations; see entity ancestors if any)

Private predicates

registry_seed_/1

Last allocated registry identifier.

Compilation flags:
dynamic
Template:
registry_seed_(RegistryId)
Mode and number of proofs:
registry_seed_(?positive_integer) - zero_or_one

registry_state_/2

Per-registry next session identifier state.

Compilation flags:
dynamic
Template:
registry_state_(RegistryId,NextSessionId)
Mode and number of proofs:
registry_state_(?positive_integer,?non_negative_integer) - zero_or_more

registry_session_/3

Registered sessions and their queued outbound messages indexed by registry identifier. Messages are stored in reverse order to make enqueue operations constant time.

Compilation flags:
dynamic
Template:
registry_session_(RegistryId,SessionId,QueuedMessagesReversed)
Mode and number of proofs:
registry_session_(?positive_integer,?positive_integer,?list(compound)) - zero_or_more

Operators

(none)