Forums

Flask-socket.io

HI, A year and a half ago (Jan 2019) someone asked if you supported flask-socket.io. You said you planned to do it in the future. Well, welcome to the future! It's been a year and a half and this is now a very heavily used technology in flask. Do you support it yet? If not, when?

Cheers, Paul

We are working towards it, but it's not ready yet. We don't have a timeline right now. I see that you posted in some other forum threads, so I'll also reply to those specific things there.

Ok, thanks for replying.

Yeah, this feature is very essential nowadays... I hope you guys plan on implementing it soon.

I'm guessing there still is no timeline--am I right?

That is correct - we do not have a timeline for this.

If there is no timeline then what does "working toward it" mean?

It means that there are a lot of changes that are required in order to support them, and we cannot estimate how long it will take. I'm sure you can imagine that changing a system that supports tens of thousands of websites to support a completely different system takes quite a lot of work, especially if you need to make sure that all of those existing websites continue to function after you've made the changes.

It's not about my imagination. Saying that "there are a lot of changes that are required" gives no information that anyone doesn't already understand, and at the same time gives no information on actual progress, which is what I was asking. The fact that you said 2 1/2 years ago that you planned to do it, and that about a year ago that you were "working towards it" yet provide no updates or any actual real response on where you are leaves me and I'm assuming most of us thinking that for all we know it could be 10 years. At this point I'm not really interested in keeping the conversation going, so, signing off...

Can't speak for anyone on the PA staff, but if you can implement 1 requested feature that will take 2 years or 3 requested features that will take 1 year, you choose the latter. I think a lot of us have been there. It takes a lot to keep a site like this running before you even get the chance to start on a new feature. They are constantly doing a lot of background improvements related to speed, upkeep, etc that you never really see (again, I think a lot of us have been there too). Additionally, I can see how socket support could prove difficult with their shared WSGI setup. tbh I think it's completely understandable.<br><br>

PA isn't a monster tech company that can put a whole team on designing a single share button...they are a small team of a few devs that have done pretty good in my opinion :-)<br><br>

PA isn't going to match every use case...works for me just fine but maybe not for what someone else is building...that's why the ecosystem is so diverse. Your best bet is a VPS for your use case, I think.<br><br>

P.S. made me wonder how long I've been here and looked. First "Welcome to PA" email was back in January of 2016 lol

Yeah, @tylerhand I'm aware of the way prioritizations work. But if you read more closely, you'll see that our comments are more about the messaging, not the actual timeline. There is no meaningful messaging. That's the point.

@chafe66 Glenn told you all about that. We are doing other things.

Then just say you're not doing it instead of "we're working toward it" and stringing people along for 2-3 years, giving the impression that you're actually doing something. Just think of how much time and conversation you would have saved with "no we're not doing it" instead of what was said. Christ.

Some preliminary work was done, but we are not following that path at a moment but we plan to.

Haha funny enough I just figured out how to set up a Flask app with PythonAnywhere (which uses flask_socketio), tried to import it and received an error ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/usr/lib/python3.8/site-packages/python_engineio-4.2.0.dist-info' Consider using the--useroption or check the permissions. when trying to import it, but I saw this was updated 13 hours ago and yall dont have flask_socketio. ):

got it, thanks

Just to touch again on the timeline aspect -- estimation of large tasks is hard. Changing large-scale systems with many moving parts is particularly hard to estimate. It's hard enough when your team is the sole owner of the code that is running, but when 99% of the code that your system runs is code that is provided by the users of the system it's pretty much impossible.

Here's a concrete example: one of the things that we had to get done on the path to getting WebSockets working was to provide a full /proc filesystem so that certain programs can run. We released that a month or so back, and switched everyone over to it. For most people, it had no effect -- most Python stuff runs just fine without /proc. For a large minority of people, it was a big win -- they could now use Chrome to do web-scraping with Selenium. In the long term, it will make it possible to support WebSockets, so it's a good thing all round.

But for one person out of all of the tens of thousands, it broke their website completely. Without going into too much detail, especially as we're still nailing down the details, a library that they are using runs in a reduced-functionality mode without /proc, but when it finds that that filesystem is present, it makes assumptions about what other things are available, and breaks. The library in question is a reasonably popular one, so we can't move forward without fixing that issue. So that adds on a week or so -- perhaps more.

I mention that example not because it's particularly interesting in and of itself, but because in any large-scale project like this, there are dozens of things like that happening all of the time. You can't predict them, which makes estimation pretty much worthless. Especially when, as @fjl mentioned earlier, the things like that which you discover while implementing something mean that you have to completely change direction.

Any estimate we gave would be no better than a wild guess, and we don't want to promise a timeline when something like the /proc thing (but larger-scale) might completely derail it.

Its now mid-2021. Have you gotten anywhere on this yet?

@derpderp please read Giles' post, which is directly above yours (from 4 days ago).

Like many others, getting socket.io to work (as well as Celery!) would be a massive (huge!) plus. Understand the difficulties you are facing implementing these "features". Just out of curiosity, if you would have implemented the possibility to run a docker container, would that have made it easier to implement these features?

We do not plan to make docker available.

New user here running away from heroku as they're shutting down free dynos. My flask app is using flask socketio. Is it still not available on your platform? Thanks.

That is correct - websockets will not work

Can we now use flask-socketio ?

Not yet; we're working on it!

what are other alternatives ?

@chatt depends on what you are trying to achieve, what are you working on?

Hello, I have the same issue, and after weeks of testing and debugging my code, I came across this thread and discovered that I have this problem because I developed my app based on sockets. Any alternatives? It's a kind of chat, simple, but sockets are for simple notifications, yet they are causing all these issues. I appreciate the help.

Not yet, but we are working on that.

Hola, sólo quería saber si ya se cuenta con sockets en la plataforma?. Saludos desde Perú.

We're testing an beta of websocket support, email support@pythonanywhere.com asking to be added and we'll add you to the beta

Can we now use flask-socketio ? Is there any hope?

@SkyForge -- we don't officially support ASGI apps yet, but we already have the infrastructure in place and are in the beta testing phase. We don't have specific instructions for Flask SocketIO, but you can try to adjust the existing ones for FastAPI and see if that would work for you. I've enabled a limited UI for ASGI web apps for you, so you would see those apps on your Web page.