Replies: 13 comments 6 replies
-
There is a complete section dedicated to Gunicorn: https://flask-socketio.readthedocs.io/en/latest/deployment.html#gunicorn-web-server |
Beta Was this translation helpful? Give feedback.
-
thank you for replying , Yes I read that section , that is where i got this command from i didn't give gevent a try as I have a very simple application, and I don't think eventlet is the issue. i'm getting |
Beta Was this translation helpful? Give feedback.
-
Sorry but you are going to have to make an effort explaining the issue in more detail. First you said you did not see any references to gunicorn in the documentation. After I pointed you to it, you claim that you've found two commands there, even though the docs show only one for eventlet. Which of the two are you using? The You also mention you are getting an error. This is too vague. Where is this error? Client? server? Maybe you have a proxy in between? What is the HTTP status code of the error? Are there any logs in the server regarding this error? See the troubleshooting section of the docs to learn how to generate Socket.IO logs. |
Beta Was this translation helpful? Give feedback.
-
*i'm sorry, I'll try to be more detailing, I have decided to make a clean ubuntu 20.04 installation with nothing on it except those i need for the socketio (python3,pip,flask, nginx, eventlet== 0.30.2, Flask_Cors,flask_socketio and gunicorn ) the data in this comment might be a lot different and that is due to the clean installation
The hosting service suggested that I use
the error I've mentioned above is on the Server ( Ngnix error.log ) on chrome there is a different error
I've modified the Ngnix a little bit, just allowing all origins but that is all I have regarding the server setup
when i used |
Beta Was this translation helpful? Give feedback.
-
my current SERVER code:
Javascript :
|
Beta Was this translation helpful? Give feedback.
-
The issue is with your nginx configuration. I recommend that you start from the nginx configuration example shown in the Socket.IO documentation, and only once you have that working start making changes to adapt it to your needs. |
Beta Was this translation helpful? Give feedback.
-
I've tried both configurations on the socketio website socket.io
then flask-socketIO.io
and I've also found the same Nginx error in the error.log
the Linux server I'm using has no domain connected to it (only public ip address so no SSL as well ), if that has anything todo with it. I Think it might has to do with the version of socket IO on the client or on the server or even the version of eventlet |
Beta Was this translation helpful? Give feedback.
-
I can't really tell you what's wrong, but the error comes from nginx, and says that it cannot connect to your upstream (the Python server). I asked you before to enable Socket.IO logs in the server and see if there was something interesting there, but you haven't done that. Not sure if this will help though. You can also try removing nginx and having your client connect directly to the Gunicorn server to see if that provides any more clues. But I really don't know. |
Beta Was this translation helpful? Give feedback.
-
could you tell me how to enable the debug mode on flask-socketio ? In the mean time I'll remove nginx and see what happens. |
Beta Was this translation helpful? Give feedback.
-
https://flask-socketio.readthedocs.io/en/latest/getting_started.html#debugging-and-troubleshooting |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
I'm sorry but I don't think I can't really help you with this. You need someone that can teach you how to do this step by step, really the problem here is your lack of experience. When I asked you to remove nginx, that does not mean uninstalling it, it means that your client needs to connect directly to your Gunicorn server, which is on port 5000.
The logs from the Python process are where you sent them. I don't know what you are doing there, it is up to you to store your logs. |
Beta Was this translation helpful? Give feedback.
-
I tried that, it made no difference
I'm sorry for inconvenient, Yes I'm new I'm still learning but I'm fast learner, plz don't give up on me :D
and yes this time i caught something interesting.
I have also reinstalled Nginx and used those settings
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello Miguel,
I made a simple app with socket-io for my class that works flawlessly on my local computer but as soon as I tried to deploy it using online I have realized that it's a whole different story and it's very hard to get it to work.
So I have decided to start up with a much simpler app because I doubt that my code is the issue rather than the right method of deployment,
Server Python-Flask :
for the client, the aim is to connect socketIO with a chat application made in unity (C#) with the backend "flask" but since Javascript is safer to test the connection, I made this simple script
for the unity wrapper i used this packaged from github.
https://github.com/KyleDulce/Unity-Socketio
and I used the a simple connect script.
Now lets talk about the system:
System = Ubuntu 20.04
pip :
system has Nginx and gunicorn installed in it.
Nginx:
I didnt do anything to Gunicorn, if I'm not wrong there was no mention of any gunicorn configuration in the flask-socketio documentation.
Errors that I've received are mostly coming from Nginx itself.
that is how I start the server
please let me know if u need anything, I'm almost available all the time.
Thank you
Beta Was this translation helpful? Give feedback.
All reactions