Forums

Flask SocketIO with PythonAnywhere?

Hi guys,

Does PythonAnywhere work with flask_socketio?

I'm looking at building some simple webapps following Miguel Grinberg's tutorial on Flask: https://blog.miguelgrinberg.com/post/easy-websockets-with-flask-and-gevent

Is there any work happening behind the scenes that will introduce this feature? If not, what is a suitable alternative to achieve bi-directional communication between a client and the server?

Thanks,

-Karl

Unfortunately we don't support it right now. We're planning to introduce support in the future using extensions to the way always-on tasks work, but we don't have a timeline right now.

For bi-directional communication right now, the best option is to poll an endpoint on your website from JavaScript.

hey is the feature available now?

-Dusk

Not yet.

Please, is flask socket io now supported on pythonanywhere?

Not yet.

is flask socket supported now??

No.

How about now?

Not yet.

Hi, I'm new to pythonanywhere and subscribed to DEV plan. I migrated my localhost flask application to pythonanywhere and website was up with no problem. But when I checked the logs I saw that socket functionality (emit, socket.on) not working. That is a big letdown as majority of my code is relying on socket (chatroom, user interaction, messaging etc.) Is there an easy alternative to socketIO that I can implement?

Unfortunately not; the system we use for hosting websites is based entirely on a request-response model, so the only way to achieve something like SocketIO is to poll the site repeatedly in JavaScript -- which is, of course, very inefficient and doesn't give great performance.

We're in the middle of building support for async websites, but it's a big change to how our system works and is taking more time than we would like.

how about now is it work?

We're working on adding support for websockets, stay tuned.