Module: WAMP::MessageType

Defined in:
lib/wamp/message_type.rb

Constant Summary collapse

TYPES =

Message types with ID per the WAMP Specification located at wamp.ws/spec#message_types

{
  WELCOME:     0,
  PREFIX:      1,
  CALL:        2,
  CALLRESULT:  3,
  CALLERROR:   4,
  SUBSCRIBE:   5,
  UNSUBSCRIBE: 6,
  PUBLISH:     7,
  EVENT:       8
}

Class Method Summary collapse

Class Method Details

.[](id) ⇒ Object

Get MessageType ID with symbolized name, or get symbolized name with an ID Usage:

WAMP::MessageType[:WELCOME] #=> 0
WAMP::MessageType[0]        #=> :WELCOME


21
22
23
24
25
26
27
# File 'lib/wamp/message_type.rb', line 21

def [](id)
  if id.is_a? Integer
    TYPES.key(id)
  else
    TYPES[id]
  end
end