Blogged by Ujihisa. Standard methods of programming and thoughts including Clojure, Vim, LLVM, Haskell, Ruby and Mathematics written by a Japanese programmer. github/ujihisa

Saturday, November 28, 2009

Trying Stomp and Stompserver on Ruby

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.


$ 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.


Get three terminals ready.

[Terminal 1]$ mkdir tmp && cd tmp
[Terminal 1]$ stompserver

[Terminal 2]$ irb -rubygems
> require 'stomp'
>'/a/b') {|m| p m.body }

[Terminal 3]$ irb -rubygems
> require 'stomp'
>'/a/b', 'Hello, world!')

And then check your terminal 2.

stompserver creates etc and log directories on the current directly and opens port 61613.

1 comment:

  1. it should be noted that "send()" doesn't work anymore since it's used by ruby internally. You should instead call `'/a/b', 'Hello, world!') ` in order to send a message.