Xtomp handbook

Client setup

There are lots of STOMP clients, and if there is not one for your language of choice they are easy to write.

Browser

xtomp supports WebSockets so any modern Browser can talk to xtomp.

JavaScript

There are no shortge of JavaScript clients

xtomp is primarliy tested with stomp-js which is a fork of this project with a couple of tweaks for testing with 100,000 of connections.

Install with npm

npm install stomp-js

For testing STOMP protocol violations and fiddling at the TCP socket level xtomp is tested with xtomp-raw

npm install stomp-raw

Python

I have tested Jason R. Briggs' python stomp.py library. stomp.py can also be installed as a much more convenient CLI.

git clone https://github.com/jasonrbriggs/stomp.py
sudo apt-get install python-setuptools
sudo python setup.py install

stomp.py supports heart-beats correctly

#> stomp --heartbeats=120000,120000


> subscribe memtop-a
Subscribing to "memtop-a" with acknowledge set to "auto", id set to "1"
>

Java

Yeti seems like a decent STOMP client for Java, from the makers of hastlecastmq.

Example Yeti client code

Stampy Java client works OK with a couple of caveats, check the issues in github. example stampy code

telnet

Telnet is a STOMP client because the protocol is so simple, the only complication is to send a \0 you need a Ctrl + @. On a US keyboard this is Ctrl + Shift + 2 it is different on different keyboards.

When you get it right, telnet will echo ^@

Presuming xtomp is running and listening on the standard port...

A simple session might be

#> telnet localhost 61613

This should reploy

telnet localhost 61613
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.

You need to type CONNECT\n\n\0 on my keyboard this is CONNECT [Enter] [Enter] [Ctrl + Shift + @]

CONNECT

^@

If you get the \0 correct this should print

CONNECTED
server:xtomp/0.2
version:1.0
session:47
heart-beat:180000,120000

N.B. the STOMP protocol requires a blank line before the \0.

Telnet actually sends a windowsy type new line \r\n, xtomp politely ignores this and behaves as expected. This means you can not send heart-beats with telnet, a heart-beat must be a single \n



by teknopaul