Class: Vines::XmppServer

Inherits:
Object
  • Object
show all
Includes:
Log
Defined in:
lib/vines/xmpp_server.rb

Overview

The main starting point for the XMPP server process. Starts the EventMachine processing loop and registers the XMPP protocol handler with the ports defined in the server configuration file.

Instance Method Summary collapse

Methods included from Log

#log, set_log_file

Constructor Details

#initialize(config) ⇒ XmppServer

Returns a new instance of XmppServer.



11
12
13
# File 'lib/vines/xmpp_server.rb', line 11

def initialize(config)
  @config = config
end

Instance Method Details

#startObject



15
16
17
18
19
20
21
22
23
# File 'lib/vines/xmpp_server.rb', line 15

def start
  log.info('XMPP server started')
  at_exit { log.fatal('XMPP server stopped') }
  EM.epoll
  EM.kqueue
  EM.run do
    @config.ports.each {|port| port.start }
  end
end