How can I get the "signed-stream-name" from a turbo:before-stream-render event?

72 views Asked by At

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: enter image description here

However the "turbo:before-stream-render" that I want to intercept does not appear to include any of this information:

enter image description here

Does anyone know how I could get this attribute?

1

There are 1 answers

0
Alex On
<%= 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);
})