socketry / async-websocket

Asynchronous WebSocket client and server, supporting HTTP/1 and HTTP/2 for Ruby.
MIT License
173 stars 17 forks source link

API changes #14

Closed matti closed 5 years ago

matti commented 5 years ago

So in my old code that used this gem before api changes I had:

            while message = @connection.next_event
              type = case message
              when WebSocket::Driver::OpenEvent
                puts "ws: open #{@env["REMOTE_ADDR"]}"
              when WebSocket::Driver::CloseEvent
                puts "ws: close #{@env["REMOTE_ADDR"]}"

What should I do now? I'm lost with the recent changes that broke all of my code.

matti commented 5 years ago
      Async::WebSocket::Adapters::Rack.open(env, protocols: ['ws']) do |conn|
        p [env["REMOTE_ADDR"], "connected"]
        while msg = conn.read do
          p ["<", msg]
        end
      end

^-- this gives:

 1.38s: <Async::Task:0x3fd7d201c9f0 failed>
      |   EOFError: Could not read frame header!
ioquatix commented 5 years ago

I've reproduced the bug locally. Now, I'm investigating.