Class: Rack::SockJS
- Inherits:
-
Object
- Object
- Rack::SockJS
- Defined in:
- lib/rack/sockjs.rb
Defined Under Namespace
Classes: DebugRequest, ExtractServerAndSession, MissingHandler, RenderErrors, ResetScriptName
Constant Summary collapse
- SERVER_SESSION_REGEXP =
%r{/([^/]*)/([^/]*)}
- DEFAULT_OPTIONS =
{ :sockjs_url => "http://cdn.sockjs.org/sockjs-#{::SockJS::PROTOCOL_VERSION}.min.js" }
Instance Attribute Summary collapse
-
#routing ⇒ Object
readonly
Returns the value of attribute routing.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(session_class, options = nil) ⇒ SockJS
constructor
A new instance of SockJS.
Constructor Details
#initialize(session_class, options = nil) ⇒ SockJS
Returns a new instance of SockJS.
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 |
# File 'lib/rack/sockjs.rb', line 144 def initialize(session_class, = nil) #TODO refactor Connection to App connection = ::SockJS::Connection.new(session_class, ) ||= {} = DEFAULT_OPTIONS.merge() @routing = Rack::Mount::RouteSet.new do |set| ::SockJS::Endpoint.add_routes(set, connection, ) set.add_route(MissingHandler.new(), {}, {}, :missing) end routing = @routing @app = Rack::Builder.new do use Rack::SockJS::ResetScriptName use DebugRequest run routing end.to_app end |
Instance Attribute Details
#routing ⇒ Object (readonly)
Returns the value of attribute routing.
167 168 169 |
# File 'lib/rack/sockjs.rb', line 167 def routing @routing end |
Instance Method Details
#call(env) ⇒ Object
169 170 171 |
# File 'lib/rack/sockjs.rb', line 169 def call(env) @app.call(env) end |