STOMP: Streaming Text Orientated Messaging Protocol is getting important, particularly for web programmers who need to think scalability.
There are Ruby implementations of STOMP, called stomp
and stompserver
.
Here is the brief introduction of them.
INSTALL
$ gem install stomp
$ gem install stompserver
Currently it is reported that stompserver
cannot be installed well on ruby 1.9. I don't know why so far.
HELLO, WORLD
Get three terminals ready.
[Terminal 1]$ mkdir tmp && cd tmp
[Terminal 1]$ stompserver
[Terminal 2]$ irb -rubygems
> require 'stomp'
> Stomp::Client.new.subscribe('/a/b') {|m| p m.body }
[Terminal 3]$ irb -rubygems
> require 'stomp'
> Stomp::Client.new.send('/a/b', 'Hello, world!')
And then check your terminal 2.
stompserver
creates etc
and log
directories on the current directly and opens port 61613.