It seems like it'd be possible to use turbolinks to automatically refresh the body of the page, but I haven't been able to find anything about how to do this. Is it possible? If so, could you point me to a resource on how to do it?
I'm not looking for how to refresh the whole page - that seems quite heavy. I'm also not asking about polling for changes, or using something like Faye to keep the page in sync. While any of these methods would work, I'm specifically asking if this is possible with turbolinks since I'm new to this feature and learning what it can do.
I thought about it some more, and realised I could have a very simple solution:
A hidden link to the current page
link_to 'current page', params, id: 'refresh_page_link', style: 'display:none;'
A tiny bit of coffeescript to trigger a click on that link every 5 seconds.
reload_periodically = ->
setTimeout (->
$('#refresh_page_link')[0].click();
return
), 5000 # 5 seconds
$(document).ready(reload_periodically)
$(document).on('page:load', reload_periodically)
That results in a weird flash on the page every reload. Clearly there are better ways to do this that wouldn't have the flash. I just wanted to learn more about turbolinks.