Method: ZSS::Message#initialize

Defined in:
lib/zss/message.rb

#initialize(args = {}) ⇒ Message

Returns a new instance of Message.



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/zss/message.rb', line 25

def initialize(args = {})

  @identity     = args[:identity]
  @protocol     = args[:protocol] || PROTOCOL_VERSION
  @type         = args[:type] || Type::REQ
  @rid          = args[:rid] || SecureRandom.uuid
  @address      = args[:address]
  @headers      = args[:headers] || {}
  @status       = args[:status]
  @payload      = args[:payload]
  @client       = nil
  @payload_size  = args[:payload_size]

  match = identity.try(:match, CLIENT_ID_REGEX)
  @client = match.captures.first if match
end