Fixed rebinding problem on every new websocked reconnect.

This commit is contained in:
Martin Edenhofer 2012-10-31 13:46:11 +01:00
parent ecd7a993e2
commit 3c7943dc27

View file

@ -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 )