Class: Wamp::Client::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.



194
195
196
197
198
199
200
201
202
# File 'lib/wamp/client/message.rb', line 194

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.



192
193
194
# File 'lib/wamp/client/message.rb', line 192

def details
  @details
end

#reasonObject

Returns the value of attribute reason.



192
193
194
# File 'lib/wamp/client/message.rb', line 192

def reason
  @reason
end

Class Method Details

.parse(params) ⇒ Object



208
209
210
211
212
213
214
215
216
# File 'lib/wamp/client/message.rb', line 208

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



204
205
206
# File 'lib/wamp/client/message.rb', line 204

def self.type
  Types::GOODBYE
end

Instance Method Details

#payloadObject



218
219
220
221
222
223
224
225
# File 'lib/wamp/client/message.rb', line 218

def payload

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

  payload
end

#to_sObject



227
228
229
# File 'lib/wamp/client/message.rb', line 227

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