Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
@Kimmax Much rather make your priorities and use whichever is available. WS is best for the task obviously, but http polling - or rather its standardised form, SSE - can also work. SetInterval isn't realtime unless you make it very fast, but then it generates a lot of traffic.
-
@Kimmax He was setting interval on socket.emit('reload')
I understand the constraints as I did something similar for my web app cause the server side event are not attachable to socket.emit part
Stack: Flask, flask socket io and vue -
ltlian21965y@chowdercake Oh man, I had the exact same stack at my previous project, with nginx and gunicorn in the middle.
It worked well for the most part, but goodness when you need to troubleshoot flask and its "it just works, probably, anyway don't worry about the internals" and socketios "it runs and connects fine but events aren't coming through because well they should".
One issue I never solved was how upon loading the Vue page, socketio would connect and receive the onconnect event from flask, but no further events could be received. No errors or warnings. If you refreshed the page it would work fine. I'm going to lie awake tonight thinking about it again. -
@Wisecrack Don't know about Itlian but here's an update on mine.
I was using just flask with socket io hence it uses ajax polling by default.
I installed gevent and it worked.
Regarding the set interval issue, I tried to pass the socetio's emit function to class object on some updation but things started to break (asyncio maybe, don't remember) and it was not okay with the original goal hence removed it.
But if you want to get class properties externally then it has to be continuous polling.
Related Rants
So I was looking for some real-time dashboard app using vue, tried searching for it on google and found some article.
He lost me at setInterval.
rant
vue
setinterval
js