Replies: 4 comments 15 replies
-
Why were you able to skip the monkey patching on your local setup? There shouldn't be any difference. Try your production setup locally, just removing nginx but leaving everything else the same. |
Beta Was this translation helpful? Give feedback.
-
I tried it, you're right. Monkey patching breaks my app.
|
Beta Was this translation helpful? Give feedback.
-
Hi @miguelgrinberg .. I ran into issues with gunicorn. After several hours of idling, it was taking up 100% CPU. And a search showed many people were facing similar issues with gunicorn. So I decided to try uWSGI. But now I'm not able to get websockets to work, it returns 400. Here's the uWSGI command that I'm running: My docker-compose logs show the following 2 lines going on forever as long as the client is connected:
Other than websockets everything else is working fine. What could be the issue? |
Beta Was this translation helpful? Give feedback.
-
Finally I found a solution to my woes, I was able to gevent monkey patch my code using the |
Beta Was this translation helpful? Give feedback.
-
I was successful in getting Flask-SocketIO to work with my Flask+React application running inside a container with nginx as the reverse proxy. I added the websocket upgrade lines to the nginx configs and all works fine.
The problem starts when I want to start using Redis queue for websockets. I need this because I want a separate remote application emitting data to my rooms. Here's my basic code:
When I run this code on my server, I got this error:
So I changed my run.py to the following:
Now nginx starts throwing this error:
[error] 10#10: *28 connect() failed (111: Connection refused) while connecting to upstream
The webpage just goes on loading and the server doesn't return any response.
Interestingly, the same code works when I tried on my local machine, and emitting data from a different unrelated process - the React client receives the data. The difference on my local machine is that there's no nginx, and I didn't need to monkey patch anything.
Can someone help me get this working?
Beta Was this translation helpful? Give feedback.
All reactions