33 lines
1.5 KiB
Ruby
33 lines
1.5 KiB
Ruby
unless File.split($0).last == 'rake'
|
|
|
|
puts "EventMachine initializer"
|
|
JamWebEventMachine.start
|
|
|
|
if APP_CONFIG.websocket_gateway_enable && File.split($0).last != 'rake' && ENV['NO_WEBSOCKET_GATEWAY'] != '1'
|
|
|
|
current = Thread.current
|
|
Thread.new do
|
|
JamWebsockets::Server.new.run(
|
|
:port => APP_CONFIG.websocket_gateway_port,
|
|
:emwebsocket_debug => APP_CONFIG.websocket_gateway_internal_debug,
|
|
:connect_time_stale_client => APP_CONFIG.websocket_gateway_connect_time_stale_client,
|
|
:connect_time_expire_client => APP_CONFIG.websocket_gateway_connect_time_expire_client,
|
|
:connect_time_stale_browser => APP_CONFIG.websocket_gateway_connect_time_stale_browser,
|
|
:connect_time_expire_browser => APP_CONFIG.websocket_gateway_connect_time_expire_browser,
|
|
:max_connections_per_user => APP_CONFIG.websocket_gateway_max_connections_per_user,
|
|
:influxdb_database => APP_CONFIG.influxdb_database,
|
|
:influxdb_username => APP_CONFIG.influxdb_username,
|
|
:influxdb_password => APP_CONFIG.influxdb_password,
|
|
:influxdb_hosts => APP_CONFIG.influxdb_hosts,
|
|
:influxdb_port => APP_CONFIG.influxdb_port,
|
|
:rabbitmq_host => APP_CONFIG.rabbitmq_host,
|
|
:rabbitmq_port => APP_CONFIG.rabbitmq_port,
|
|
:calling_thread => current,
|
|
:cidr => APP_CONFIG.websocket_gateway_cidr,
|
|
:gateway_name => "default-#{ENV["JAM_INSTANCE"] || 1}")
|
|
end
|
|
Thread.stop
|
|
end
|
|
|
|
end
|