Class: SolidObjects::ActorChannel
- Inherits:
-
ActionCable::Channel::Base
- Object
- ActionCable::Channel::Base
- SolidObjects::ActorChannel
- Defined in:
- lib/solid_objects/actor_channel.rb,
sig/generated/lib/solid_objects/actor_channel.rbs
Instance Method Summary collapse
Instance Method Details
#subscribed ⇒ void
This method returns an undefined value.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/solid_objects/actor_channel.rb', line 8 def subscribed identity = StreamToken.verify(params.fetch("token")) actor_type = identity.fetch("actor_type") actor_id = identity.fetch("actor_id") SolidObjects.registry.fetch(actor_type) = SolidObjects.configuration..call( actor_type:, actor_id:, authorization_context: connection ) return reject unless reference = Reference.new(actor_type:, actor_id:) stream_from StreamName.for(reference) ActorSnapshot.new(reference).observable_values.each do |name, value| transmit TurboStreamRenderer.observable_value(reference, name, value) end rescue KeyError, InvalidStreamToken, UnknownActorType reject end |