Reputation: 59
My project is using rails 7 with turbo streams and stimulus.
I'm trying to get the "signed-stream-name" as can be seen in the cable event:
However the "turbo:before-stream-render" that I want to intercept does not appear to include any of this information:
Does anyone know how I could get this attribute?
Upvotes: 0
Views: 180
Reputation: 30036
<%= turbo_stream_from :users, id: "some_stream" %>
You could get it from a "message" event:
document.querySelector("#some_stream").addEventListener("message", function (event) {
console.log(event.target.channel.signed_stream_name);
})
Upvotes: 0