mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Switch back to original API and callback naming
This commit is contained in:
parent
c7f00661bf
commit
53d0b22aee
3 changed files with 7 additions and 7 deletions
|
@ -5,11 +5,11 @@ class Cable.Channel
|
|||
@cable.subscribers.add(@identifier, this)
|
||||
|
||||
# Perform a channel action with the optional data passed as an attribute
|
||||
sendAction: (action, data = {}) ->
|
||||
perform: (action, data = {}) ->
|
||||
data.action = action
|
||||
@sendMessage(data)
|
||||
@send(data)
|
||||
|
||||
sendMessage: (data) ->
|
||||
send: (data) ->
|
||||
@cable.sendMessage(@identifier, JSON.stringify(data))
|
||||
|
||||
unsubscribe: ->
|
||||
|
|
|
@ -31,7 +31,7 @@ class Cable.Connection
|
|||
if data.identifier is '_ping'
|
||||
@pingReceived(data.message)
|
||||
else
|
||||
@cable.subscribers.notify(data.identifier, "onMessage", data.message)
|
||||
@cable.subscribers.notify(data.identifier, "received", data.message)
|
||||
|
||||
onConnect: =>
|
||||
@startWaitingForPing()
|
||||
|
@ -50,7 +50,7 @@ class Cable.Connection
|
|||
disconnect: ->
|
||||
@removeExistingConnection()
|
||||
@resetPingTime()
|
||||
@cable.subscribers.notifyAll("onDisconnect")
|
||||
@cable.subscribers.notifyAll("disconnected")
|
||||
|
||||
reconnect: ->
|
||||
@disconnect()
|
||||
|
|
|
@ -5,12 +5,12 @@ class Cable.SubscriberManager
|
|||
add: (identifier, subscriber) ->
|
||||
@subscribers[identifier] = subscriber
|
||||
if @cable.sendCommand(identifier, "subscribe")
|
||||
@notify(identifier, "onConnect")
|
||||
@notify(identifier, "connected")
|
||||
|
||||
reload: ->
|
||||
for identifier in Object.keys(@subscribers)
|
||||
if @cable.sendCommand(identifier, "subscribe")
|
||||
@notify(identifier, "onConnect")
|
||||
@notify(identifier, "connected")
|
||||
|
||||
remove: (identifier) ->
|
||||
if subscriber = @subscribers[identifier]
|
||||
|
|
Loading…
Reference in a new issue