Horizon: Support for websockets as an alternative to client-side polling

Created on 19 Dec 2017  路  5Comments  路  Source: laravel/horizon

The horizon dashboard would probably a lot lighter if there it could be configured to listen for broadcasted events rather than polling constantly for new data. This should probably be a configurable option, defaulting to polling (since not every application has websockets set up). AFAICT, this should be reasonably easy to implement using https://laravel.com/docs/5.5/broadcasting

enhancement

Most helpful comment

And now that https://github.com/beyondcode/laravel-websockets has been release... ! :)

All 5 comments

That's... actually not a bad idea. I'll mark this as a feature request. We can definitely check in on that at some point I think.

And now that https://github.com/beyondcode/laravel-websockets has been release... ! :)

The idea is good, but since broadcasting uses queues... won't that make for an endless loop?

  1. Job is done
  2. Send broadcast
  3. Queue broadcast job
  4. Run broadcast job
  5. Broadcast job is done
  6. Go to 2.

Ahahaha that's an interesting thought!

I think we could avoid that by instead pushing scheduled bundled updates every x seconds instead of pushing on every job completion. That would be way too many websockets events on production systems, most likely. Or instead, just request an update over websockets every x seconds, i.e. still polling, but doing so over the same connection which is much lighter.

Although I like this idea I think this would require quite a bit of work in order to pull this off properly. That's why we won't be working on this ourselves. If anyone can send in a clean PR for this we could consider it.

Was this page helpful?
0 / 5 - 0 ratings