Class: Wildnet::Server::Kernel
- Inherits:
-
Object
- Object
- Wildnet::Server::Kernel
- Defined in:
- lib/wildnet-server/kernel.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(app, options = {}) ⇒ Kernel
constructor
A new instance of Kernel.
- #start ⇒ Object
Constructor Details
#initialize(app, options = {}) ⇒ Kernel
Returns a new instance of Kernel.
23 24 25 26 |
# File 'lib/wildnet-server/kernel.rb', line 23 def initialize app, = {} @app = app @options = end |
Class Method Details
.run(app, options = {}) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/wildnet-server/kernel.rb', line 11 def self.run app, = {} [:Port] ||= 3000 [:Host] ||= "0.0.0.0" @@server = self.new(app, ) @@server.start Thread.new do while true sleep 10 end end.join end |
Instance Method Details
#start ⇒ Object
28 29 30 31 32 |
# File 'lib/wildnet-server/kernel.rb', line 28 def start @bootstrap = ServerBootstrap.new(NioServerSocketChannelFactory.new(Executors.newCachedThreadPool, Executors.newCachedThreadPool)) @bootstrap.setPipelineFactory(PipeLineFactory.new(@app)) @bootstrap.bind(InetSocketAddress.new(@options[:Host], @options[:Port])) end |