class Turbo::StreamsChannel
<%= turbo_stream_from ‘room’, channel: CustomChannel %>turbo_stream_from
helper:
This channel can be connected to a web page using :channel
option in
end
end
# …
def subscription_allowed?
end
end
reject
else
stream_from stream_name
subscription_allowed?
if (stream_name = verified_stream_name_from_params).present? &&
def subscribed
include Turbo::Streams::StreamName::ClassMethods
extend Turbo::Streams::Broadcasts, Turbo::Streams::StreamName
class CustomChannel < ActionCable::Channel::Base
helper modules like Turbo::Streams::StreamName
:
In case if custom behavior is desired, one can create their own channel and re-use some of the primitives from
If the signed stream name cannot be verified, the subscription is rejected.
using the view helper Turbo::StreamsHelper#turbo_stream_from(*streamables)
.
into signed stream name using Turbo::Streams::StreamName#signed_stream_name
. This is automatically done
The subscription relies on being passed a signed_stream_name
parameter generated by turning a set of streamables
A subscription to this channel is made for each individual stream that one wishes to listen for updates to.
The streams channel delivers all the turbo-stream actions created (primarily) through Turbo::Broadcastable
.
def subscribed
def subscribed if stream_name = verified_stream_name_from_params stream_from stream_name else reject end end