Forums

Slowing down while using socketIO

I made a chat application using flask and socketIO it worked perfectly when i run it in localhost

.

.

But my aim is to run it on python anywhere and use it with my friends, but when i hosted the application is pythonanywhere it was very very slow and when i check the server log

.

.

Traceback (most recent call last): 2024-06-09 12:07:47 File "/bin/user_wsgi_wrapper.py", line 207, in call 2024-06-09 12:07:47 app_iterator = self.app(environ, start_response) 2024-06-09 12:07:47 File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 2095, in call 2024-06-09 12:07:47 return self.wsgi_app(environ, start_response) 2024-06-09 12:07:47 File "/home/srlg/.local/lib/python3.10/site-packages/flask_socketio/init.py", line 43, in call 2024-06-09 12:07:47 return super(SocketIOMiddleware, self).__call__(environ, 2024-06-09 12:07:47 File "/home/srlg/.local/lib/python3.10/site-packages/engineio/middleware.py", line 63, in __call__ 2024-06-09 12:07:47 return self.engineio_app.handle_request(environ, start_response) 2024-06-09 12:07:47 File "/home/srlg/.local/lib/python3.10/site-packages/socketio/server.py", line 430, in handle_request 2024-06-09 12:07:47 return self.eio.handle_request(environ, start_response) 2024-06-09 12:07:47 File "/home/srlg/.local/lib/python3.10/site-packages/engineio/server.py", line 274, in handle_request 2024-06-09 12:07:47 packets = socket.handle_get_request( 2024-06-09 12:07:47 File "/home/srlg/.local/lib/python3.10/site-packages/engineio/socket.py", line 90, in handle_get_request 2024-06-09 12:07:47 return getattr(self, '_upgrade' + transport)(environ, 2024-06-09 12:07:47 File "/home/srlg/.local/lib/python3.10/site-packages/engineio/socket.py", line 146, in _upgrade_websocket 2024-06-09 12:07:47 return ws(environ, start_response) 2024-06-09 12:07:47 File "/home/srlg/.local/lib/python3.10/site-packages/engineio/async_drivers/gevent_uwsgi.py", line 62, in call 2024-06-09 12:07:47 self.app(self) 2024-06-09 12:07:47 File "/home/srlg/.local/lib/python3.10/site-packages/engineio/socket.py", line 178, in _websocket_handler 2024-06-09 12:07:47 pkt = websocket_wait() 2024-06-09 12:07:47 File "/home/srlg/.local/lib/python3.10/site-packages/engineio/socket.py", line 151, in websocket_wait 2024-06-09 12:07:47 data = ws.wait() 2024-06-09 12:07:47 File "/home/srlg/.local/lib/python3.10/site-packages/engineio/async_drivers/gevent_uwsgi.py", line 140, in wait 2024-06-09 12:07:47 self._send(msg) 2024-06-09 12:07:47 File "/home/srlg/.local/lib/python3.10/site-packages/engineio/async_drivers/gevent_uwsgi.py", line 83, in _send 2024-06-09 12:07:47 method(msg) 2024-06-09 12:07:47 SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats 2024-06-09 12:07:47 #012During handling of the above exception, another exception occurred: 2024-06-09 12:07:47 Traceback (most recent call last): 2024-06-09 12:07:47 File "/bin/user_wsgi_wrapper.py", line 214, in call 2024-06-09 12:07:47 start_response('500 Internal Server Error', [('Content-type', 'text/html')]) 2024-06-09 12:07:47 OSError: headers already sent

This error comes repeatedly

Will love to hear what I did wrong!!

This might be because it relies on websocket connections and we don't officially support that yet.

Do you still not support websocket as of today?

We have experimental support, with no UI but you can control the sites using a command-line interface. If you're using Flask-SocketIO, this help page has the details.