celluloid / reel

UNMAINTAINED: See celluloid/celluloid#779 - Celluloid::IO-powered web server
https://celluloid.io
MIT License
596 stars 87 forks source link

Missing protocols definition on websocket driver #239

Open madsheep opened 7 years ago

madsheep commented 7 years ago

If the incoming ws request before upgrade had Sec-WebSocket-Protocol header, the reply should include that header as well.

With Websocket::Driver you can handle that by using the protocols option: https://github.com/faye/websocket-driver-ruby#driver-api

With that set, the driver will automatically negotiate the protocol. In reel, we are unable to set this option, due to how the driver is initialized: https://github.com/celluloid/reel/blob/master/lib/reel/websocket.rb#L20 This causes reel to never send the subprotocol header.

In result reel is unusable when the browser sends in the protocol value - the websocket will be closed by the browser with following error: