Please join the Rack Specification discussion for `env['upgrade.websocket']`
I represent an effort to extend Rack so that it allows server-side websocket upgrade implementation support and pure Rack websocket applications. This new Rack feature proposal is gaining support, with over 42 support votes in the [original Rack discussion thread](https://github.com/rack/rack/issues/1093). You may have read [my blog post about this](https://bowild.wordpress.com/2016/07/31/the-dark-side-of-the-rack/) or [the reddit discussion](https://www.reddit.com/r/ruby/comments/4vgdlc/the_dark_side_of_the_rack_and_websockets_dreams/). This proposal simplifies Websocket applications by leaving all the network complexity were it is (with the application's web server), allowing application programmers to focus on their application logic. Using [the proposed specification](https://github.com/boazsegev/iodine/issues/6), a pure Rack Websocket echo server could be written as simply as: ```ruby # this is a toy example. class MyEcho def initialize(env = nil) # optional initialization end def on_message(data) write "Echo: #{data}" end end app = Proc.new do |env| if env['upgrade.websocket?'] && env['HTTP_UPGRADE'] =~ /websocket/i env['upgrade.websocket'] = MyEcho.new(env) # or simply `MyEcho` [ 0, {'X-Header': 'data'}, [] ] else [200, { 'Content-Length' => '12' }, ['He11o World!']] end end run app ``` There's [a working Gist chatroom example](https://gist.github.com/boazsegev/1466442c913a8dd4271178cab9d98a27). I invite you to join [the discussion](https://github.com/rack/rack/issues/1093) and help shape the [proposed specification](https://github.com/boazsegev/iodine/issues/6).
