如果我手动刷新页面,我的电缆效果很好,但如果我导航到它,它就永远不会开始流式传输。
如果工作正常,我在Rails控制台中看到了这一点:
ChecklistPdfChannel is transmitting the subscription confirmation
ChecklistPdfChannel is streaming from checklist_pdf_2-5a-ntiasohen-gattopuin
这是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
我尝试过以下方法:
<meta name="turbolinks-cache-control" content="no-cache">
'data-turbolinks-track': 'reload'
开发和登台/生产(Heroku)中的行为是相同的。
Rails 5.2.2,ActionCable 5.2.2,Turbolinks 5.2.0
所以我能够让这个工作的唯一方法是在我需要电缆活动的页面上添加这个元标记:
<meta name="turbolinks-visit-control" content="reload">