class CelluloidPubsub::ClientConnection

Public Class Methods

new(url, handler) click to toggle source
Calls superclass method
# File lib/celluloid_pubsub/client_connection.rb, line 11
def initialize(url, handler)
  @shutting_down = false
  super(url, handler)
end

Public Instance Methods

actor_died(actor, reason) click to toggle source

method called when the actor is exiting

@param [actor] actor - the current actor @param [Hash] reason - the reason it crashed

@return [void]

@api public

# File lib/celluloid_pubsub/client_connection.rb, line 52
def actor_died(actor, reason)
  @shutting_down = true
  log_debug "Oh no! #{actor.inspect} has died because of a #{reason.class}"
end
run() click to toggle source
Calls superclass method
# File lib/celluloid_pubsub/client_connection.rb, line 16
def run
  super
rescue EOFError, Errno::ECONNRESET, StandardError
  @client.emit(:close, ::WebSocket::Driver::CloseEvent.new(1001, 'server closed connection'))
end
shutdown() click to toggle source

the method will terminate the current actor

@return [void]

@api public

# File lib/celluloid_pubsub/client_connection.rb, line 38
def shutdown
  @shutting_down = true
  log_debug "#{self.class} tries to 'shutdown'"
  terminate
end
shutting_down?() click to toggle source

the method will return true if the actor is shutting down

@return [Boolean] returns true if the actor is shutting down

@api public

# File lib/celluloid_pubsub/client_connection.rb, line 28
def shutting_down?
  @shutting_down == true
end