Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add broadcast_periodic method #89

Closed
julianrubisch opened this issue Dec 26, 2020 · 5 comments
Closed

Add broadcast_periodic method #89

julianrubisch opened this issue Dec 26, 2020 · 5 comments
Labels
proposal ruby Pull requests that update Ruby code

Comments

@julianrubisch
Copy link
Contributor

@leastbad brought this to our attention in Discord: https://api.rubyonrails.org/classes/ActionCable/Channel/PeriodicTimers/ClassMethods.html

I think it could be nice to shim this in CableReady so you can easily provide periodic updates.

Could be out of scope but I can instantly think of at least a handful cases where I could make good use of it.

@leastbad
Copy link
Contributor

I'm excited about it, but I admit I don't currently know exactly how you're proposing this could work.

What I've always wanted is a way to kick off a thread or worker process that can fire code on a regular or scheduled basis, whether it be heartbeats or something else. You and @marcoroth have previously suggested that Ractors could help with this, but the implications of that assertion are sadly still beyond my understanding.

My enthusiasm for the PeriodicTimers functionality was that it seemed like perhaps a way to make a heartbeat-like functionality possible, sooner.

@julianrubisch
Copy link
Contributor Author

I admit I haven't yet looked at how or where this is implemented. I guess you can use this on your channel, which is persistent by default, and just transmit a partial every few seconds.

I'm thinking about everything that polls external services: dashboards, ...

@rickychilcott
Copy link

If done correctly, this period timer could be useful in one of the wishlist items I shared in stimulusreflex/futurism#64

@leastbad
Copy link
Contributor

I've continued to think about this all day. My current leaning is towards documenting it as a pattern, but I'm not currently able to picture it being a part of the API surface.

It's more like what's needed is someone to show the world how to kick ass using it?

@julianrubisch
Copy link
Contributor Author

I'll try to concoct something after the holidays. I think this is difficult to reason about unless you have your head in it and an actual use case to test.

But I think a first class implementation would open many doors. @hopsoft ?

@leastbad leastbad added proposal ruby Pull requests that update Ruby code labels Apr 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal ruby Pull requests that update Ruby code
Projects
None yet
Development

No branches or pull requests

3 participants