SocketIO and Flask Rest API
I created a socketio flask rest api and it works great locally for retriving and sending data through the websockets, but as soon as I upload my code onto the railway server, the server doesn't work with my websockets. Is there any special configuration I need to do?
[2024-01-09 06:21:11 +0000] [7] [CRITICAL] WORKER TIMEOUT (pid:11)
[2024-01-09 06:21:11 +0000] [11] [INFO] Worker exiting (pid: 11)
[2024-01-09 06:21:12 +0000] [7] [WARNING] Worker with pid 11 was terminated due to signal 9
[2024-01-09 06:21:12 +0000] [22] [INFO] Booting worker with pid: 22
Invalid session MLd5ydxTdW6sDXnBAAAA (further occurrences of this error will be logged with level INFO)
18 Replies
Project ID:
4cc29972-e583-4641-81d0-26868fcc02e7
4cc29972-e583-4641-81d0-26868fcc02e7
we are going to need more information than "the server doesn't work"
The error I provided is all that is shown in my logs
are you using gunicorn when on railway?
yeah:
web: gunicorn main:app
have you confirmed it's working locally when starting your app with that command?
Just tested it, it doesn't appear to work, so im guessing its an issue on my side
does gunicorn even natively support websockets? maybe you want to use Daphne instead?
I'll check right now
I think the start command for Daphne would be
so add daphne to your requirements.txt and then update the web command in your Procfile to that command above
Im currently facing the same problem. Its giving me headaches ðŸ§
well the things ive already said would apply to you, so give daphne a try
Let me do so, will brb
I user geventlet and it started working (with gunicorn)
This is the command:
web: gunicorn --worker-class eventlet -w 1 main:app
Will this be considered a good solution?
Will we be able to use both HTTP and TCP traffic?
since when did gunicorn without geventlet support tcp??
idk
it's one of the first things I found that worked so I just kept it for now