Class: WampClient::Message::Goodbye

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

Overview

Goodbye Sent by a Peer to close a previously opened WAMP session. Must be echo’ed by the receiving Peer. Formats:

[GOODBYE, Details|dict, Reason|uri]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Check

included

Constructor Details

#initialize(details, reason) ⇒ Goodbye

Returns a new instance of Goodbye.



272
273
274
275
276
277
278
279
280
# File 'lib/wamp_client/message.rb', line 272

def initialize(details, reason)

  self.class.check_dict('details', details)
  self.class.check_uri('reason', reason)

  self.details = details
  self.reason = reason

end

Instance Attribute Details

#detailsObject

Returns the value of attribute details.



270
271
272
# File 'lib/wamp_client/message.rb', line 270

def details
  @details
end

#reasonObject

Returns the value of attribute reason.



270
271
272
# File 'lib/wamp_client/message.rb', line 270

def reason
  @reason
end

Class Method Details

.parse(params) ⇒ Object



286
287
288
289
290
291
292
293
294
# File 'lib/wamp_client/message.rb', line 286

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



282
283
284
# File 'lib/wamp_client/message.rb', line 282

def self.type
  Types::GOODBYE
end

Instance Method Details

#payloadObject



296
297
298
299
300
301
302
303
# File 'lib/wamp_client/message.rb', line 296

def payload

  payload = [self.class.type]
  payload.push(self.details)
  payload.push(self.reason)

  payload
end

#to_sObject



305
306
307
# File 'lib/wamp_client/message.rb', line 305

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