7 library(http/hub): Manage a hub for websockets
All Application Manual Name SummaryHelp

  • Documentation
    • Reference manual
    • Packages
      • SWI-Prolog HTTP support
        • library(http/hub): Manage a hub for websockets
          • hub_create/3
          • current_hub/2
          • hub_add/3
          • hub_member/2
          • hub_send/2
          • hub_broadcast/2
          • hub_broadcast/3
Availability::- use_module(library(http/hub)).
Source[det]hub_create(+Name, -Hub, +Options)
Create a new hub. Hub is a dict containing the following public information:
Hub . name
The name of the hub (the Name argument)
queues . event
Message queue to which the hub thread(s) can listen.

After creating a hub, the application normally creates a thread that listens to Hub.queues.event and exposes some mechanisms to establish websockets and add them to the hub using hub_add/3.

See also
http_upgrade_to_websocket/3 establishes a websocket from the SWI-Prolog webserver.