Class: Minicron::Transport::FayeServer

Inherits:
Object
  • Object
show all
Defined in:
lib/minicron/transport/faye/server.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeFayeServer

Returns a new instance of FayeServer.


11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/minicron/transport/faye/server.rb', line 11

def initialize
  # Load the Faye thin adapter, this needs to happen first
  Faye::WebSocket.load_adapter('thin')

  # Show debug verbose output if requested
  if Minicron.config['verbose']
    log = Logger.new(STDOUT)
    log.level = Logger::DEBUG
    Faye.logger = log
  end

  # Set up our Faye rack app
  @server = Faye::RackAdapter.new(
    :mount => '', # This is relative to the map faye_path set in server.rb
    :timeout => 25
  )

  @server.add_extension(Minicron::Transport::FayeJobHandler.new)

  # Add all the events we want to listen out for
  add_faye_events
end

Instance Attribute Details

#serverObject (readonly)

Returns the value of attribute server


9
10
11
# File 'lib/minicron/transport/faye/server.rb', line 9

def server
  @server
end