Closed kenichi closed 9 years ago
Oops, sorry @jcoglan, the real PR is over here!
I might be missing something but I think you need to map more headers than are in RACK_HEADERS
. https://github.com/faye/websocket-driver-ruby#usage lists env parameters used by the WebSocket protocol.
Oh, I did leave out the older protocol keys. See the thread on the original websocket-driver integration. Reel has already parsed the headers, which is why Driver.rack
is being called instead of Driver.server
. Reel has already decided that:
I'll add the 'Origin', and key{1,2} headers to the map to support the older browsers.
Should 'Sec-WebSocket-Extensions' be on that list?
https://github.com/faye/websocket-driver-ruby/blob/master/lib/websocket/driver/hybi.rb#L241
@kenichi Yes, it should. Personally, I would just map all the headers into the Rack env format so as not to encode knowledge about the WebSocket protocol into Reel, but if you would rather be explicit then you need all the listed keys to support older versions. If you only want to support the RFC version then what you have looks fine to me.
@jcoglan thanks, I added the header keys to support the older versions. Reel::Request::Info already knows a little bit about the protocol... I could be convinced about key translation. My main goal was remove the rack gem dependency from reel. Thoughts, @tarcieri @digitalextremist?
I really don't care beyond removing the rack dependency. Whatever works. Supporting older browsers would be nice if it's not too much extra work.
k, this should be ready to go then.
Will test a couple things and cut tonight!
this should resolve #186 and #187 - in my testing, this limited amount of rack mimicry works, no need for a full gem dependency and
Rack::MockRequest
instantiation.also, this adds a forward to the driver for
WebSocket#ping
.