Module: Iodine::Rack

Defined in:
lib/iodine/rack_utils.rb,
lib/rack/handler/iodine.rb,
ext/iodine/iodine_helpers.c

Overview

Iodine's Rack module provides a Rack compliant interface (connecting Iodine to Rack) for an HTTP and Websocket Server.

Defined Under Namespace

Modules: Utils

Constant Summary collapse

IODINE_RACK_LOADED =
true

Class Method Summary collapse

Class Method Details

.run(app, options = {}) ⇒ Object

Runs a Rack app, as par the Rack handler requirements.



12
13
14
15
16
17
18
19
20
21
# File 'lib/rack/handler/iodine.rb', line 12

def self.run(app, options = {})
  if !defined?(Rage::CLI) && ENV["RSPEC_TEST_ENV"]
    Iodine.listen(service: :http, handler: app, port: options[:Port], address: options[:Host])
    Iodine.start
  else
    Rage::CLI.new([], { port: options[:Port], binding: options[:Host], environment: options[:environment] }).server
  end

  true
end

.shutdownObject

patches an assumption by Rack, issue #98 code donated by @Shelvak (Néstor Coppi)



24
25
26
# File 'lib/rack/handler/iodine.rb', line 24

def self.shutdown
  Iodine.stop
end