Ruby on Rails
Friday, October 21, 2016
Hi,
-- I apologise if this has already been answered, but I cannot find anything relating to the topic when searching around.
I am using Rails 5.0.0.1 with ActionCable 5.0.0.1
What I am trying to achieve is creating a dashboard page, with various graphs and indicators that are updated in real time or semi-real time. I have managed to get ActionCable setup and working with a few graphs, and now I would like to use it to update a graph that shows the server load. Previously I had this working with js making a query to a controller action every second or so, which would then call a bash script, and return the results. I would like to convert this to a websocket, but I cannot find a way to do this cleanly.
What I have tried so far:
- Create a script similar to the ones in /bin that inherit the rails environment and settings, and try to broadcast to the websocket. I realised that this doesn't work as its creating a new instance of the app environment, so wont broadcast to the currently running rails server.
- Create a client based off of https://github.com/NullVoxPopuli/action_cable_client, however this has the drawback that the client will also receive its own updates.
Can anyone suggest anything else that might work, or a better way to do this?
Thanks
/Cole
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/912b8351-68d2-4cd6-a9ff-dbf9a56df8d1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment