Class: Wamp::Client::Message::Challenge

Inherits:
Base
  • Object
show all
Defined in:
lib/wamp/client/message.rb

Overview

Challenge The “CHALLENGE” message is used with certain Authentication Methods. During authenticated session establishment, a Router sends a challenge message. Formats:

[CHALLENGE, AuthMethod|string, Extra|dict]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Check

included

Constructor Details

#initialize(authmethod, extra) ⇒ Challenge

Returns a new instance of Challenge.



1143
1144
1145
1146
1147
1148
1149
1150
1151
# File 'lib/wamp/client/message.rb', line 1143

def initialize(authmethod, extra)

  self.class.check_string('authmethod', authmethod)
  self.class.check_dict('extra', extra)

  self.authmethod = authmethod
  self.extra = extra

end

Instance Attribute Details

#authmethodObject

Returns the value of attribute authmethod.



1141
1142
1143
# File 'lib/wamp/client/message.rb', line 1141

def authmethod
  @authmethod
end

#extraObject

Returns the value of attribute extra.



1141
1142
1143
# File 'lib/wamp/client/message.rb', line 1141

def extra
  @extra
end

Class Method Details

.parse(params) ⇒ Object



1157
1158
1159
1160
1161
1162
1163
1164
1165
# File 'lib/wamp/client/message.rb', line 1157

def self.parse(params)

  self.check_gte('params list', 3, params.count)
  self.check_equal('message type', self.type, params[0])

  params.shift
  self.new(*params)

end

.typeObject



1153
1154
1155
# File 'lib/wamp/client/message.rb', line 1153

def self.type
  Types::CHALLENGE
end

Instance Method Details

#payloadObject



1167
1168
1169
1170
1171
1172
1173
1174
# File 'lib/wamp/client/message.rb', line 1167

def payload

  payload = [self.class.type]
  payload.push(self.authmethod)
  payload.push(self.extra)

  payload
end

#to_sObject



1176
1177
1178
# File 'lib/wamp/client/message.rb', line 1176

def to_s
  'CHALLENGE > ' + self.payload.to_s
end