Comments (19)
also running into this now. anyone managed to find out what's happening?
from falcon.
Hi! I just ran into this issue as well. If there's an obvious step, I also missed it, I get the same error.
Kind of weird that ::WebSocket::Driver.websocket?
would return false, as it's super generic and not changed for 9 years:
def self.websocket?(env)
connection = env['HTTP_CONNECTION'] || ''
upgrade = env['HTTP_UPGRADE'] || ''
env['REQUEST_METHOD'] == 'GET' and
connection.downcase.split(/ *, */).include?('upgrade') and
upgrade.downcase == 'websocket'
end
Does env
get mangled somehow?
from falcon.
I released v0.4.1 which has the fixes discussed above, except the server will still print the warning which you can ignore.
from falcon.
I released v0.4.1 which has the fixes discussed above, except the server will still print the warning which you can ignore.
Thank you ! Now it work like a charm ❤️ I will test further
from falcon.
Yooo just tuning in to say that adding protocol-rack 0.4.1 to my Gemfile seems to have solved the issue. supercool 👍
from falcon.
Thanks for the reports of success. As such, I'll close this issue. Feel free to open a new issue if you find other problems.
from falcon.
I will take a look, thanks for the detailed information.
from falcon.
Oh actually there's a hint in the logged message:
Failed to upgrade to WebSocket (REQUEST_METHOD: GET, HTTP_CONNECTION: keep-alive, Upgrade, HTTP_UPGRADE: )
Note how the HTTP_UPGRADE is empty, and instead there's an Upgrade
in HTTP_CONNECTION
instead..
edit: Nvm, upgrade should to be there. But in the HTTP_UPGRADE there's supposed to be a websocket
string as well.
from falcon.
11:56:29 E ActionCable -- Failed to upgrade to WebSocket (REQUEST_METHOD: GET, HTTP_CONNECTION: Upgrade, HTTP_UPGRADE: )
we're running into this too, we can't really use Falcon without nginx because of this
from falcon.
Thanks for the reminder, I'll take a look.
from falcon.
I believe this is a similar issue to socketry/async-websocket#55
If possible, can someone test adding the following middleware to see if it resolves the issue:
class RackProtocolToConnectionUpgrade
def initialize(app)
@app = app
end
def call(env)
if protocol = env['rack.protocol']
env['HTTP_UPGRADE'] = protocol
# Maybe need to modify connection header too.
end
@app.call(env)
end
end
This won't work for HTTP/2 however...
from falcon.
I have same problem, action cable not working on rails 7.1.2 with falcon. Tried to use middleware - same result, with middleware https://github.com/rails/rails/blob/355fd5929058ee3a73032c5f62de3d8819550482/actioncable/lib/action_cable/connection/stream.rb#L97C56-L97C56 @socket_object.env["rack.hijack"]
return nil
from falcon.
Thanks for the reports, after thinking about this problem, I'll try to address it directly in protocol-rack
with a compatibility shim.
from falcon.
Apologies, I've realised the issue here. Full hijack is not supported by protocol-rack
. I'll look into potential solutions. In the past it was supported, but it's replaced by full-bidirectional streaming in Rack 3 and that's what falcon provides out of the box since it's a better abstraction. I'll consider if there is an easy way to make this work with ActionCable.
from falcon.
After playing around with it, it wasn't so hard to restore full hijack support. This should work. However, I don't think full hijack is a good long term solution for Falcon. Can you please try protocol-rack
v0.4+ and it should work.
from falcon.
After playing around with it, it wasn't so hard to restore full hijack support. This should work. However, I don't think full hijack is a good long term solution for Falcon. Can you please try
protocol-rack
v0.4+ and it should work.
Hello, i tried with protocol-rack v0.4+
.
First i got error on this line https://github.com/socketry/protocol-rack/blob/3a9ff0ef95198c3e4070c723ce54bc63d7dd4074/lib/protocol/rack/adapter/generic.rb#L77
NameError: uninitialized constant Protocol::Rack::Adapter::Generic::RACK_HIJACK
. I rewrite it to Protocol::Rack::Adapter::Rack2::RACK_HIJACK
and this error is gone.
Then i got error in middleware env['HTTP_UPGRADE'] = protocol
, change to env['HTTP_UPGRADE'] = protocol.first
, this fix second error.
Then i got this error, and i stuck on it (
warn: Async::Task: Reading HTTP/1.1 requests for Async::HTTP::Protocol::HTTP1::Server. [oid=0x4a10] [ec=0x3a5c] [pid=12191] [2023-12-11 10:12:59 +0300]
| Task may have ended with unhandled exception.
| NoMethodError: undefined method `write' for nil:NilClass
| → .rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/protocol-http1-0.16.0/lib/protocol/http1/connection.rb:126 in `write_response'
| .rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/async-http-0.61.0/lib/async/http/protocol/http1/server.rb:63 in `each'
| .rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/async-http-0.61.0/lib/async/http/server.rb:40 in `accept'
| .rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/async-io-1.38.0/lib/async/io/server.rb:15 in `block in accept_each'
| .rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/async-io-1.38.0/lib/async/io/socket.rb:58 in `block in accept'
| .rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/async-2.6.5/lib/async/task.rb:160 in `block in run'
| .rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/async-2.6.5/lib/async/task.rb:330 in `block in schedule'
from falcon.
Just to confirm, you are using Rack 3+ right?
Oh, also, that "warning" you can ignore for now, it's because the connection got hijacked and it can't write a normal response, it's noisy but shouldn't impact the websocket.
from falcon.
Ohhhh it looks like I put the constant in the wrong place... hold on, let me fix that.
from falcon.
Ah, you no longer need the middleware proposed on this issue either, so you can remove that completely.
from falcon.
Related Issues (20)
- Super slowly Time.parse HOT 29
- falcon fails to start with "unsupported signal `SIGHUP'" HOT 1
- warning: 'Rack::Handler is deprecated and replaced by Rackup::Handler' on Rack 3 HOT 1
- upstream hijacking, streamed uploads HOT 2
- Expect continue HOT 10
- crashes on launch with ruby 3.2 HOT 8
- The problem with io-event update to 1.3.0 HOT 7
- Limiting incoming requests queue HOT 3
- Sinatra - cannot load such file -- sinatra/base HOT 2
- Concurrent Database Transaction worries HOT 2
- Getting a Errno::EPIPE: Broken pipe warning HOT 11
- Socket::ResolutionError: getnameinfo: Temporary failure in name resolution HOT 10
- Should the 'virtual' command be changing the Console.logger log level? HOT 4
- Plugin `:tmp_restart` HOT 1
- Falcon not working properly locally on MacOS (m1) in forked mode HOT 17
- Production ready? HOT 1
- How to install? HOT 4
- Falcon 0.44 broken when used with Rack 2 HOT 7
- Falcon no longer respects count, new likely increases memory usage on shared hosts HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from falcon.