Class: EventMachine::Protocols::Stomp::Message

### Home Classes Methods

### In Files

- lib/em/protocols/stomp.rb

### Parent

Object

### Methods

- ::new
- #consume_line

### Files

- ChangeLog
- DEFERRABLES
- EPOLL
- INSTALL
- KEYBOARD
- LEGAL
- LIGHTWEIGHT_CONCURRENCY
- PURE_RUBY
- RELEASE_NOTES
- SMTP
- SPAWNED_PROCESSES
- TODO

### Class/Module Index

Quicksearch

- EventMachine
- EventMachine
- EventMachine::Channel
- EventMachine::Completion
- EventMachine::Connection
- EventMachine::DNS
- EventMachine::DNS::Request
- EventMachine::DNS::RequestIdAlreadyUsed
- EventMachine::DNS::Resolver
- EventMachine::DNS::Socket
- EventMachine::DatagramObject
- EventMachine::DefaultDeferrable
- EventMachine::Deferrable
- EventMachine::DeferrableChildProcess
- EventMachine::Error
- EventMachine::EvmaKeyboard
- EventMachine::EvmaTCPClient
- EventMachine::EvmaTCPServer
- EventMachine::EvmaUDPSocket
- EventMachine::EvmaUNIXClient
- EventMachine::EvmaUNIXServer
- EventMachine::FileNotFoundException
- EventMachine::FileStreamer
- EventMachine::FileWatch
- EventMachine::Iterator
- EventMachine::LoopbreakReader
- EventMachine::PeriodicTimer
- EventMachine::Pool
- EventMachine::ProcessWatch
- EventMachine::Protocols
- EventMachine::Protocols
- EventMachine::Protocols::HeaderAndContentProtocol
- EventMachine::Protocols::HttpClient
- EventMachine::Protocols::HttpClient2
- EventMachine::Protocols::HttpClient2::Request
- EventMachine::Protocols::LineAndTextProtocol
- EventMachine::Protocols::LineProtocol
- EventMachine::Protocols::LineText2
- EventMachine::Protocols::Memcache
- EventMachine::Protocols::Memcache::ParserError
- EventMachine::Protocols::ObjectProtocol
- EventMachine::Protocols::Postgres3
- EventMachine::Protocols::SASLauth
- EventMachine::Protocols::SASLauthclient
- EventMachine::Protocols::SmtpClient
- EventMachine::Protocols::SmtpServer
- EventMachine::Protocols::Socks4
- EventMachine::Protocols::Stomp
- EventMachine::Protocols::Stomp::Message
- EventMachine::Protocols::TcpConnectTester
- EventMachine::Queue
- EventMachine::Reactor
- EventMachine::Selectable
- EventMachine::SpawnedProcess
- EventMachine::StreamObject
- EventMachine::SystemCmd
- EventMachine::ThreadedResource
- EventMachine::TickLoop
- EventMachine::Timer
- EventMachine::UuidGenerator
- EventMachine::YieldBlockFromSpawnedProcess
- Object
- Object::EM
- Object::P
- BufferedTokenizer
- IO
- StringIO
- TestConnection

No matching classes.

# EventMachine::Protocols::Stomp::Message

### Attributes

body[RW]

Body of the message

command[RW]

The command associated with the message, usually 'CONNECTED' or 'MESSAGE'

header[RW]

Hash containing headers such as destination and message-id

headers[RW]

Hash containing headers such as destination and message-id

### Public Class Methods

new() click to toggle source

@private

    # File lib/em/protocols/stomp.rb, line 68
    def initialize
      @header = {}
      @state = :precommand
      @content_length = nil
    end

### Public Instance Methods

consume_line(line) click to toggle source

@private

    # File lib/em/protocols/stomp.rb, line 74
    def consume_line line
      if @state == :precommand
        unless line =~ /\A\s*\Z/
          @command = line
          @state = :headers
        end
      elsif @state == :headers
        if line == ""
          if @content_length
            yield( [:sized_text, @content_length+1] )
          else
            @state = :body
            yield( [:unsized_text] )
          end
        elsif line =~ /\A([^:]+):(.+)\Z/
          k = $1.dup.strip
          v = $2.dup.strip
          @header[k] = v
          if k == "content-length"
            @content_length = v.to_i
          end
        else
          # This is a protocol error. How to signal it?
        end
      elsif @state == :body
        @body = line
        yield( [:dispatch] )
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.