* make rabbitmq_host and rabbitmq_port configurable for websocket-gateway
This commit is contained in:
parent
314d3c9dac
commit
5f67ad3290
|
|
@ -10,7 +10,9 @@ unless $rails_rake_task
|
|||
:port => APP_CONFIG.websocket_gateway_port,
|
||||
:emwebsocket_debug => APP_CONFIG.websocket_gateway_internal_debug,
|
||||
:connect_time_stale => APP_CONFIG.websocket_gateway_connect_time_stale,
|
||||
:connect_time_expire => APP_CONFIG.websocket_gateway_connect_time_expire)
|
||||
:connect_time_expire => APP_CONFIG.websocket_gateway_connect_time_expire,
|
||||
:rabbitmq_host => APP_CONFIG.rabbitmq_host,
|
||||
:rabbitmq_port => APP_CONFIG.rabbitmq_port)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -48,4 +48,6 @@ Object.send(:remove_const, :Rails) # this is to 'fool' new relic into not thinki
|
|||
Server.new.run(:port => config["port"],
|
||||
:emwebsocket_debug => config["emwebsocket_debug"],
|
||||
:connect_time_stale => config["connect_time_stale"],
|
||||
:connect_time_expire => config["connect_time_expire"])
|
||||
:connect_time_expire => config["connect_time_expire"],
|
||||
:rabbitmq_host => config['rabbitmq_host'],
|
||||
:rabbitmq_port => config['rabbitmq_port'])
|
||||
|
|
|
|||
|
|
@ -6,14 +6,20 @@ development:
|
|||
port: 6767
|
||||
verbose: true
|
||||
emwebsocket_debug: false
|
||||
rabbitmq_host: localhost
|
||||
rabbitmq_port: 5672
|
||||
<<: *defaults
|
||||
|
||||
test:
|
||||
port: 6769
|
||||
verbose: true
|
||||
rabbitmq_host: localhost
|
||||
rabbitmq_port: 5672
|
||||
<<: *defaults
|
||||
|
||||
production:
|
||||
port: 6767
|
||||
verbose: false
|
||||
verbose: false
|
||||
rabbitmq_host: localhost
|
||||
rabbitmq_port: 5672
|
||||
<<: *defaults
|
||||
|
|
|
|||
|
|
@ -17,8 +17,10 @@ module JamWebsockets
|
|||
port = options[:port]
|
||||
connect_time_stale = options[:connect_time_stale].to_i
|
||||
connect_time_expire = options[:connect_time_expire].to_i
|
||||
rabbitmq_host = options[:rabbitmq_host]
|
||||
rabbitmq_port = options[:rabbitmq_port].to_i
|
||||
|
||||
@log.info "starting server #{host}:#{port} with staleness_time=#{connect_time_stale}; reconnect time = #{connect_time_expire}"
|
||||
@log.info "starting server #{host}:#{port} staleness_time=#{connect_time_stale}; reconnect time = #{connect_time_expire}, rabbitmq=#{rabbitmq_host}:#{rabbitmq_port}"
|
||||
|
||||
EventMachine.error_handler{|e|
|
||||
@log.error "unhandled error #{e}"
|
||||
|
|
@ -26,7 +28,7 @@ module JamWebsockets
|
|||
}
|
||||
|
||||
EventMachine.run do
|
||||
@router.start(connect_time_stale) do
|
||||
@router.start(connect_time_stale, host: rabbitmq_host, port: rabbitmq_port) do
|
||||
# take stale off the expire limit because the call to stale will
|
||||
# touch the updated_at column, adding an extra stale limit to the expire time limit
|
||||
# expire_time = connect_time_expire > connect_time_stale ? connect_time_expire - connect_time_stale : connect_time_expire
|
||||
|
|
|
|||
Loading…
Reference in New Issue