Module: Iodine::Rack
- Defined in:
- lib/rack/handler/iodine.rb,
ext/iodine/iodine_helpers.c
Overview
Iodine’s Rack module provides a Rack complient 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
-
.address ⇒ Object
get/set the HTTP socket binding address.
-
.address=(val) ⇒ Object
get/set the HTTP socket binding address.
-
.app ⇒ Object
get/set the Rack application.
-
.app=(val) ⇒ Object
get/set the Rack application.
-
.log ⇒ Object
get/set the HTTP logging value (true / false).
-
.log=(val) ⇒ Object
get/set the HTTP logging value (true / false).
-
.max_body ⇒ Object
get/set the maximum HTTP body size for incoming data.
-
.max_body=(val) ⇒ Object
get/set the maximum HTTP body size for incoming data.
-
.max_body_size ⇒ Object
get/set the maximum HTTP body size for incoming data.
-
.max_body_size=(val) ⇒ Object
get/set the maximum HTTP body size for incoming data.
-
.max_headers ⇒ Object
get/set the maximum HTTP header length for incoming requests.
-
.max_headers=(val) ⇒ Object
get/set the maximum HTTP header length for incoming requests.
-
.max_msg ⇒ Object
get/set the maximum Websocket body size for incoming data.
-
.max_msg=(val) ⇒ Object
get/set the maximum Websocket body size for incoming data.
-
.max_msg_size ⇒ Object
get/set the maximum Websocket body size for incoming data.
-
.max_msg_size=(val) ⇒ Object
get/set the maximum Websocket body size for incoming data.
-
.port ⇒ Object
get/set the HTTP listening port.
-
.port=(val) ⇒ Object
get/set the HTTP listening port.
-
.public ⇒ Object
get/set the HTTP public folder property.
-
.public=(val) ⇒ Object
get/set the HTTP public folder property.
-
.run(app, options = {}) ⇒ Object
Runs a Rack app, as par the Rack handler requirements.
-
.timeout ⇒ Object
get/set the HTTP connection timeout property.
-
.timeout=(t) ⇒ Object
get/set the HTTP connection timeout property.
-
.ws_timeout ⇒ Object
get/set the Websocket connection timeout property.
-
.ws_timeout=(t) ⇒ Object
get/set the Websocket connection timeout property.
Class Method Details
.address ⇒ Object
get/set the HTTP socket binding address. Defaults to ‘nil` (usually best).
131 132 133 |
# File 'lib/rack/handler/iodine.rb', line 131 def self.address @address end |
.address=(val) ⇒ Object
get/set the HTTP socket binding address. Defaults to ‘nil` (usually best).
126 127 128 |
# File 'lib/rack/handler/iodine.rb', line 126 def self.address=(val) @address = val end |
.app ⇒ Object
get/set the Rack application.
12 13 14 |
# File 'lib/rack/handler/iodine.rb', line 12 def self.app @app end |
.app=(val) ⇒ Object
get/set the Rack application.
7 8 9 |
# File 'lib/rack/handler/iodine.rb', line 7 def self.app=(val) @app = val end |
.log ⇒ Object
get/set the HTTP logging value (true / false). Defaults to the incoming argumrnts or ‘false`.
109 110 111 |
# File 'lib/rack/handler/iodine.rb', line 109 def self.log @log end |
.log=(val) ⇒ Object
get/set the HTTP logging value (true / false). Defaults to the incoming argumrnts or ‘false`.
104 105 106 |
# File 'lib/rack/handler/iodine.rb', line 104 def self.log=(val) @log = val end |
.max_body ⇒ Object
get/set the maximum HTTP body size for incoming data. Defaults to ~50Mb.
65 66 67 |
# File 'lib/rack/handler/iodine.rb', line 65 def self.max_body @max_body end |
.max_body=(val) ⇒ Object
get/set the maximum HTTP body size for incoming data. Defaults to ~50Mb. 0 values are silently ignored.
60 61 62 |
# File 'lib/rack/handler/iodine.rb', line 60 def self.max_body=(val) @max_body = val end |
.max_body_size ⇒ Object
get/set the maximum HTTP body size for incoming data. Defaults to ~50Mb.
56 57 58 |
# File 'lib/rack/handler/iodine.rb', line 56 def self.max_body_size @max_body end |
.max_body_size=(val) ⇒ Object
get/set the maximum HTTP body size for incoming data. Defaults to ~50Mb. 0 values are silently ignored.
51 52 53 |
# File 'lib/rack/handler/iodine.rb', line 51 def self.max_body_size=(val) @max_body = val end |
.max_headers ⇒ Object
get/set the maximum HTTP header length for incoming requests. Defaults to ~32Kb.
76 77 78 |
# File 'lib/rack/handler/iodine.rb', line 76 def self.max_headers @max_headers end |
.max_headers=(val) ⇒ Object
get/set the maximum HTTP header length for incoming requests. Defaults to ~32Kb. 0 values are silently ignored.
71 72 73 |
# File 'lib/rack/handler/iodine.rb', line 71 def self.max_headers=(val) @max_headers = val end |
.max_msg ⇒ Object
get/set the maximum Websocket body size for incoming data. Defaults to defaults to ~250KB. 0 values are silently ignored.
98 99 100 |
# File 'lib/rack/handler/iodine.rb', line 98 def self.max_msg @max_msg end |
.max_msg=(val) ⇒ Object
get/set the maximum Websocket body size for incoming data. Defaults to defaults to ~250KB. 0 values are silently ignored.
93 94 95 |
# File 'lib/rack/handler/iodine.rb', line 93 def self.max_msg=(val) @max_msg = val end |
.max_msg_size ⇒ Object
get/set the maximum Websocket body size for incoming data. Defaults to defaults to ~250KB. 0 values are silently ignored.
88 89 90 |
# File 'lib/rack/handler/iodine.rb', line 88 def self.max_msg_size @max_msg end |
.max_msg_size=(val) ⇒ Object
get/set the maximum Websocket body size for incoming data. Defaults to defaults to ~250KB. 0 values are silently ignored.
83 84 85 |
# File 'lib/rack/handler/iodine.rb', line 83 def self.max_msg_size=(val) @max_msg = val end |
.port ⇒ Object
get/set the HTTP listening port. Defaults to 3000.
120 121 122 |
# File 'lib/rack/handler/iodine.rb', line 120 def self.port @port end |
.port=(val) ⇒ Object
get/set the HTTP listening port. Defaults to 3000.
115 116 117 |
# File 'lib/rack/handler/iodine.rb', line 115 def self.port=(val) @port = val end |
.public ⇒ Object
get/set the HTTP public folder property. Defaults to ‘nil`.
46 47 48 |
# File 'lib/rack/handler/iodine.rb', line 46 def self.public @public end |
.public=(val) ⇒ Object
get/set the HTTP public folder property. Defaults to the incoming arguments or ‘nil`.
40 41 42 |
# File 'lib/rack/handler/iodine.rb', line 40 def self.public=(val) @public = val end |
.run(app, options = {}) ⇒ Object
Runs a Rack app, as par the Rack handler requirements.
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
# File 'lib/rack/handler/iodine.rb', line 137 def self.run(app, = {}) # nested applications... is that a thing? if @app && @app != app old_app = @app @app = proc do |env| ret = old_app.call(env) ret = app.call(env) if !ret.is_a?(Array) || (ret.is_a?(Array) && ret[0].to_i == 404) ret end else @app = app end @port = [:Port].to_s if [:Port] @address = [:Address].to_s if [:Address] # # provide Websocket features using Rack::Websocket # Rack.send :remove_const, :Websocket if defined?(Rack::Websocket) # Rack.const_set :Websocket, ::Iodine::Websocket # start Iodine Iodine.start # # remove the Websocket features from Rack::Websocket # Rack.send :remove_const, :Websocket true end |
.timeout ⇒ Object
get/set the HTTP connection timeout property. Defaults to 40 seconds.
23 24 25 |
# File 'lib/rack/handler/iodine.rb', line 23 def self.timeout @timeout end |
.timeout=(t) ⇒ Object
get/set the HTTP connection timeout property. Defaults to 40. Limited to a maximum of 255. 0 values are silently ignored.
18 19 20 |
# File 'lib/rack/handler/iodine.rb', line 18 def self.timeout=(t) @timeout = t end |
.ws_timeout ⇒ Object
get/set the Websocket connection timeout property. Defaults to 40 seconds. Limited to a maximum of 255. 0 values are silently ignored.
34 35 36 |
# File 'lib/rack/handler/iodine.rb', line 34 def self.ws_timeout @ws_timeout end |
.ws_timeout=(t) ⇒ Object
get/set the Websocket connection timeout property. Defaults to 40 seconds. Limited to a maximum of 255. 0 values are silently ignored.
29 30 31 |
# File 'lib/rack/handler/iodine.rb', line 29 def self.ws_timeout=(t) @ws_timeout = t end |