I have a cable that works great if I manually refresh the page, but if I navigate to it, it never starts streaming.
WHen working correctly, I see this in the Rails console:
ChecklistPdfChannel is transmitting the subscription confirmation
ChecklistPdfChannel is streaming from checklist_pdf_2-5a-ntiasohen-gattopuin
Here's the coffeescript:
document.addEventListener 'turbolinks:load', ->
if !App.presence
App.presence = App.cable.subscriptions.create({
channel: 'ChecklistPdfChannel',
issueable_id: window.location.pathname.split('/').splice(2,1).toString()
},
connected: ->
disconnected: ->
received: (data) ->
console.log(data)
$('#pdf_status').html "#{data.html}"
)
return
I've tried the following:
<meta name="turbolinks-cache-control" content="no-cache">
'data-turbolinks-track': 'reload'
on the asset calls in the layoutthe behavior is the same in both development and staging/production (Heroku).
Rails 5.2.2, ActionCable 5.2.2, Turbolinks 5.2.0
So the only way I was able to get this to work was to add this meta tag on the pages where I needed the cable active:
<meta name="turbolinks-visit-control" content="reload">