Class: WampRails::Command::BaseCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/wamp_rails/commands/base_command.rb

Direct Known Subclasses

BaseHandler, Call, Publish

Defined Under Namespace

Classes: CallbackArgs

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ BaseCommand

Returns a new instance of BaseCommand.



16
17
18
19
# File 'lib/wamp_rails/commands/base_command.rb', line 16

def initialize(client)
  self.queue = Queue.new
  self.client = client
end

Instance Attribute Details

#clientObject

Returns the value of attribute client.



4
5
6
# File 'lib/wamp_rails/commands/base_command.rb', line 4

def client
  @client
end

#queueObject

Returns the value of attribute queue.



4
5
6
# File 'lib/wamp_rails/commands/base_command.rb', line 4

def queue
  @queue
end

Instance Method Details

#callback(result, error, details) ⇒ Object

Used in sub-classes to handle the response



33
34
35
# File 'lib/wamp_rails/commands/base_command.rb', line 33

def callback(result, error, details)
  self.queue.push(CallbackArgs.new(result, error, details))
end

#executeObject

Executes the command. This is called by the library in the EM Thread



28
29
30
# File 'lib/wamp_rails/commands/base_command.rb', line 28

def execute
  # Override when sub classing
end

#sessionObject

Returns the session from the client



22
23
24
# File 'lib/wamp_rails/commands/base_command.rb', line 22

def session
  self.client.wamp.session
end