File: README.md

package info (click to toggle)
swi-prolog 9.2.9%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 84,456 kB
  • sloc: ansic: 401,705; perl: 374,799; lisp: 9,080; cpp: 8,920; java: 5,525; sh: 3,282; javascript: 2,690; python: 2,655; ruby: 1,594; yacc: 845; makefile: 440; xml: 317; sed: 12; sql: 6
file content (52 lines) | stat: -rw-r--r-- 1,312 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# A STOMP client for SWI-Prolog

A [STOMP](http://stomp.github.io) client.

This  package  provides  `library(stomp)`  for   a  standard  SWI-Prolog
installation.    The    initial    implementation      is    based    on
https://github.com/honnix/stompl  by  Hongxin  Liang  which  provided  a
SWI-Prolog add-on by the name `stompl`.

## Supported STOMP versions

STOMP versions 1.0, 1.1 and 1.2 are supported.

## Example

```
:- module(ex, []).

:- use_module(library(stomp)).

connect(Connection) :-
    stomp_connection('127.0.0.1':32772,
                     '/',
                     _{'heart-beat': '5000,5000',
                       login: guest,
                       passcode: guest
                      },
                     on_frame, Connection),
    stomp_connect(Connection).

on_frame(connected, Connection, _Header, _Body) :-
    ...
on_frame(message, Connection, Header, Body) :-
    ...
on_frame(disconnected, Connection, _Header, _Body) :-
    ...
on_frame(error, Connection, Header, Body) :-
    ...
on_frame(heartbeat_timeout, Connection, _Header, _Body) :-
    ...

% Sending messages

    ...
    stomp_send_json(Connection, '/queue/test', _{hello: "World"}).
```

For more examples, please check source code under `examples` directory.

## License

Licensed under the BSD-2 license