Class: Wampproto::Message::Welcome

Inherits:
Base
  • Object
show all
Defined in:
lib/wampproto/message/welcome.rb

Overview

welcome message

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

type, #type

Constructor Details

#initialize(session_id, details = {}) ⇒ Welcome

Returns a new instance of Welcome.



9
10
11
12
13
# File 'lib/wampproto/message/welcome.rb', line 9

def initialize(session_id, details = {})
  super()
  @session_id = Validate.int!("Session Id", session_id)
  @details = Validate.hash!("Details", details)
end

Instance Attribute Details

#detailsObject (readonly)

Returns the value of attribute details.



7
8
9
# File 'lib/wampproto/message/welcome.rb', line 7

def details
  @details
end

#session_idObject (readonly)

Returns the value of attribute session_id.



7
8
9
# File 'lib/wampproto/message/welcome.rb', line 7

def session_id
  @session_id
end

Class Method Details

.parse(wamp_message) ⇒ Object



35
36
37
38
# File 'lib/wampproto/message/welcome.rb', line 35

def self.parse(wamp_message)
  _type, session_id, details = wamp_message
  new(session_id, details)
end

Instance Method Details

#authextraObject



31
32
33
# File 'lib/wampproto/message/welcome.rb', line 31

def authextra
  @authextra ||= details.fetch(:authextra) if details.member?(:authextra)
end

#authidObject



23
24
25
# File 'lib/wampproto/message/welcome.rb', line 23

def authid
  @authid ||= details[:authid]
end

#authmethodObject



27
28
29
# File 'lib/wampproto/message/welcome.rb', line 27

def authmethod
  @authmethod ||= details[:authmethod]
end

#authroleObject



19
20
21
# File 'lib/wampproto/message/welcome.rb', line 19

def authrole
  @authrole ||= details.fetch(:authrole, [])
end

#marshalObject



15
16
17
# File 'lib/wampproto/message/welcome.rb', line 15

def marshal
  [Type::WELCOME, @session_id, @details]
end