Show if partner is online
This commit is contained in:

committed by
Sebastian Serth

parent
97764bd02e
commit
056a8e5107
@ -3,11 +3,13 @@
|
||||
class SynchronizedEditorChannel < ApplicationCable::Channel
|
||||
def subscribed
|
||||
stream_from specific_channel
|
||||
ActionCable.server.broadcast(specific_channel, {command: 'connection_change', status: 'connected', current_user_id: current_user.id, current_user_name: current_user.name})
|
||||
end
|
||||
|
||||
def unsubscribed
|
||||
# Any cleanup needed when channel is unsubscribed
|
||||
stop_all_streams
|
||||
ActionCable.server.broadcast(specific_channel, {command: 'connection_change', status: 'disconnected', current_user_id: current_user.id, current_user_name: current_user.name})
|
||||
end
|
||||
|
||||
def specific_channel
|
||||
@ -22,4 +24,8 @@ class SynchronizedEditorChannel < ApplicationCable::Channel
|
||||
def send_changes(message)
|
||||
ActionCable.server.broadcast(specific_channel, message['delta_with_user_id'])
|
||||
end
|
||||
|
||||
def send_hello
|
||||
ActionCable.server.broadcast(specific_channel, {command: 'hello', status: 'connected', current_user_id: current_user.id, current_user_name: current_user.name})
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user