3

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.

Comments
  • 3
    It's either setIntervall, http pooling or websockets.
    Make your choice
  • 0
    @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.
  • 0
    @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
  • 2
    @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.
  • 0
    @ltlian

    It's been 20 days I'd very much like to know how this went Itlian.
  • 1
    @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.
  • 1
    @chowdercake

    "continuous polling"

    RIP concurrent user count.
  • 0
    @Wisecrack Didn't get you
Add Comment