Skip to content

Commit

Permalink
move whisper logic to subscriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
Georgiy Melnikov committed Jul 2, 2024
1 parent e1e1f4e commit 7f2a1d6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
6 changes: 0 additions & 6 deletions lib/anycable/rails/action_cable_ext/channel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,6 @@ def stop_all_streams
connection.anycable_socket.unsubscribe_from_all identifier
end

def whisper(payload)
return unless whisper_stream

broadcast_to whisper_stream, payload
end

private

def anycabled?
Expand Down
5 changes: 4 additions & 1 deletion lib/anycable/rails/action_cable_ext/whisper_stream.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ def execute_command(data)
end

def whisper(data)
find(data).whisper(ActiveSupport::JSON.decode(data["data"]))
subscription = find(data)
if subscription.whisper_stream
connection.anycable_socket.whisper data["identifier"], subscription.whisper_stream
end
end
end)

0 comments on commit 7f2a1d6

Please sign in to comment.