Module | EventMachine::Protocols::Stomp
In: | lib/em/protocols/stomp.rb

Implements Stomp (docs.codehaus.org/display/STOMP/Protocol).

## Usage example

     module StompClient
       include EM::Protocols::Stomp

       def connection_completed
         connect :login => 'guest', :passcode => 'guest'
       end

       def receive_msg msg
         if msg.command == "CONNECTED"
           subscribe '/some/topic'
         else
           p ['got a message', msg]
           puts msg.body
         end
       end
     end

     EM.run{
       EM.connect 'localhost', 61613, StompClient
     }

### Methods

ack connect receive_msg send subscribe

### Included Modules

LineText2

### Classes and Modules

Class EventMachine::Protocols::Stomp::Message

### Public Instance methods

ack(msgid)

ACK command, for acknowledging receipt of messages

     module StompClient
       include EM::P::Stomp

       def connection_completed
         connect :login => 'guest', :passcode => 'guest'
         # subscribe with ack mode
         subscribe '/some/topic', true
       end

       def receive_msg msg
         if msg.command == "MESSAGE"
           ack msg.headers['message-id']
           puts msg.body
         end
       end
     end

connect(parms={})

CONNECT command, for authentication

     connect :login => 'guest', :passcode => 'guest'

receive_msg(msg)

Invoked with an incoming Stomp::Message received from the STOMP server

send(destination, body, parms={})

SEND command, for publishing messages to a topic

     send '/topic/name', 'some message here'

subscribe(dest, ack=false)

SUBSCRIBE command, for subscribing to topics

     subscribe '/topic/name', false

[Validate]