• Places
    • Home
    • Graphs
    • Prefixes
  • Admin
    • Users
    • Settings
    • Plugins
    • Statistics
  • CPACK
    • Home
    • List packs
    • Submit pack
  • Repository
    • Load local file
    • Load from HTTP
    • Load from library
    • Remove triples
    • Clear repository
  • Query
    • YASGUI SPARQL Editor
    • Simple Form
    • SWISH Prolog shell
  • Help
    • Documentation
    • Tutorial
    • Roadmap
    • HTTP Services
  • Login

1.2 Reconnecting
All Application Manual Name SummaryHelp

  • Documentation
    • Reference manual
    • Packages
      • STOMP -- a SWI-Prolog STOMP client
        • library(stomp): STOMP client.
          • Reconnecting
            • stomp_connection/5
            • stomp_connection/6
            • stomp_connection_property/2
            • stomp_destroy_connection/1
            • stomp_setup/2
            • stomp_teardown/1
            • stomp_reconnect/1
            • stomp_connect/1
            • stomp_connect/2
            • stomp_send/4
            • stomp_send_json/4
            • stomp_subscribe/4
            • stomp_unsubscribe/2
            • stomp_ack/3
            • stomp_nack/3
            • stomp_ack/2
            • stomp_nack/2
            • stomp_begin/2
            • stomp_commit/2
            • stomp_abort/2
            • stomp_transaction/2
            • stomp_disconnect/2
Availability::- use_module(library(stomp)).(can be autoloaded)
Source[det]stomp_connection(+Address, +Host, +Headers, :Callback, -Connection)
[det]stomp_connection(+Address, +Host, +Headers, :Callback, -Connection, +Options)
Create a connection reference. The connection is not set up yet by this predicate. Callback is called on any received frame except for heart beat frames as below.
call(Callback, Command, Connection, Header, Body)

Where command is one of the commands below. Header is a dict holding the STOMP frame header, where all values are strings except for the 'content-length' key value which is passed as an integer.

Body is a string or, if the data is of the type application/json, a dict.

connected
A connection was established. Connection and Header are valid.
disconnected
The connection was lost. Only Connection is valid.
message
A message arrived. All three arguments are valid. Body is a dict if the content-type of the message is application/json and a string otherwise.
heartbeat
A heartbeat was received. Only Connection is valid. This callback is also called for each newline that follows a frame. These newlines can be a heartbeat, but can also be additional newlines that follow a frame.
heartbeat_timeout
No heartbeat was received. Only Connection is valid.
error
An error happened. All three arguments are valid and handled as message.

Note that stomp_teardown/1 causes the receiving and heartbeat thread to be signalled with abort/0.

Options processed:

reconnect(+Bool)
Try to reestablish the connection to the server if the connection is lost. Default is false
connect_timeout(+Seconds)
Maximum time to try and reestablish a connection. The default is 600 (10 minutes).
json_options(+Options)
Options passed to json_read_dict/3 to translate application/json content to Prolog. Default is [].
Address is a valid address for tcp_connect/3. Normally a term Host:Port, e.g., localhost:32772.
Host is a path denoting the STOMP host. Often just /.
Headers is a dict with STOMP headers used for the CONNECT request.
Connection is an opaque ground term that identifies the connection.
ClioPatria (version V3.1.1-51-ga0b30a5)