Fixed rebinding problem on every new websocked reconnect.
This commit is contained in:
parent
ecd7a993e2
commit
3c7943dc27
1 changed files with 6 additions and 4 deletions
|
@ -25,6 +25,12 @@ class _Singleton extends App.Controller
|
|||
supported: true
|
||||
|
||||
constructor: (@args) ->
|
||||
|
||||
# bind to send messages
|
||||
App.Event.bind 'ws:send', (data) =>
|
||||
@send(data)
|
||||
|
||||
# inital connect
|
||||
@connect()
|
||||
|
||||
send: (data) =>
|
||||
|
@ -140,10 +146,6 @@ class _Singleton extends App.Controller
|
|||
console.log( "ws:onmessage event:" + item['event'] )
|
||||
App.Event.trigger( item['event'], item['data'] )
|
||||
|
||||
# bind to send messages
|
||||
App.Event.bind 'ws:send', (data) =>
|
||||
@send(data)
|
||||
|
||||
@ws.onclose = (e) =>
|
||||
console.log( 'onclose', e )
|
||||
|
||||
|
|
Loading…
Reference in a new issue