Open tyrauber opened 10 years ago
Any update on that?
My memory is a little rust but I think the Rack Hijack spec says to return a 0, which is why tubesock does that. Perhaps that has changed? On Apr 15, 2015 6:21 AM, "Sebastian Nowak" notifications@github.com wrote:
Any update on that?
— Reply to this email directly or view it on GitHub https://github.com/ngauthier/tubesock/issues/32#issuecomment-93304979.
@ngauthier Looks like it has, see this: https://github.com/rack/rack/commit/36a2145561c52313efb95b910de2feb5cc105d0b
So perhaps it's ok to just return a 200? Can anyone try it out?
It returns tubesock-0.2.5/lib/tubesock.rb:100:in select': no implicit conversion of Rack::Lint::HijackWrapper into IO
error
It is because newer version of rack has Rack::HiJackWrapper
with slighty different interface which tubesock
didn't support now. I will submit a patch later today or in the weekend. Currently I monkey-patched it in my project and it works smoothly.
Thanks
On Fri, Apr 17, 2015 at 2:12 PM, Sebastian Nowak notifications@github.com wrote:
It is because newer version of rack has Rack::HiJackWrapper with slighty different interface which tubesock didn't support now. I will submit a patch later today or in the weekend. Currently I monkey-patched it in my project and it works smoothly.
— Reply to this email directly or view it on GitHub https://github.com/ngauthier/tubesock/issues/32#issuecomment-94042597.
Spend some time on it. Locally I have problems to update tests to pass with my code so instead of PR I show you my code. My monkey-patch looks like:
def each_frame
framebuffer = WebSocket::Frame::Incoming::Server.new(version: @version)
io = @socket.instance_variable_get(:@io)
while IO.select([io])
if @socket.respond_to?(:recvfrom)
data = io.recvfrom(2000)
else
data = io.readpartial(2000) #, @socket.peeraddr
end
break if data.empty?
framebuffer << data
while frame = framebuffer.next
case frame.type
when :close
return
when :text, :binary
yield frame.data
end
end
end
rescue Errno::EHOSTUNREACH, Errno::ETIMEDOUT, Errno::ECONNRESET, IOError, Errno::EBADF
nil # client disconnected or timed out
end
I am sure it could be better implemented, but it shows idea what have changed. Rack::HiJackWrapper
has some forward method defined https://github.com/rack/rack/blob/master/lib/rack/lint.rb#L498 maybe some of them can be used here instead of directly messing up with wrapper io
instance variable.
Tubesock crashes in Rails4.2.0.beta with the following error:
This can be demonstrated in the sock-chat demo app by updating the Gemfile to Rails 4.2.0.beta2.