3 ms·
This could be done without a gem relatively easy if you're using Rails5+ & ActionCable. Basically generate a uuid to use as a channel identifier, then pass tha
by deedubaya 9y ago
This could be done without a gem relatively easy if you're using Rails5+ & ActionCable.
Basically generate a uuid to use as a channel identifier, then pass that uuid to the front end to subscribe to. Pass the uuid to your ActionCable background job to do the expensive rendering in a background queue and push the information over the websocket channel. Have the JS insert it appropriately (maybe the contents of the element with an id of the uuid).
This would have the benefit of displacing the expensive computation in a background job, which wouldn't impact other web requests.