Class: Batsd::Server::Daemon
- Inherits:
-
Object
- Object
- Batsd::Server::Daemon
- Defined in:
- lib/batsd/server.rb
Overview
Bind to port+2 and serve up data over TCP. Offers access to both the set of datapoints and the values as JSON arrays.
Instance Method Summary (collapse)
-
- (Daemon) initialize(options = {})
constructor
Create a new daemon and expose options.
-
- (Object) run
Run the server.
Constructor Details
- (Daemon) initialize(options = {})
Create a new daemon and expose options
75 76 77 78 79 80 |
# File 'lib/batsd/server.rb', line 75 def initialize(={}) = @bind = [:bind] || '0.0.0.0' @port = ([:port] || 8125) + 2 Batsd::Server.config = .merge(port: @port) end |
Instance Method Details
- (Object) run
Run the server
83 84 85 86 87 88 |
# File 'lib/batsd/server.rb', line 83 def run EventMachine.threadpool_size = 100 EventMachine::run do EventMachine::start_server(@bind, @port, Batsd::Server) end end |