             @_num_attempts = 0
 
             conn.removeAllListeners('data')
+            conn.on("data", ondata)
 
             if auth_token?
                 @sign_in_using_auth_token

        if @_connected
            return @_conn.latency

    _delete_websocket_cookie: =>
        console.log('websocket -- delete cookie')
        misc_page.delete_cookie('SMCSERVERID3')

    _fix_connection: =>
        console.log("websocket --_fix_connection... ")
        @_delete_websocket_cookie()
        @_conn.end()
        @_conn.open()


            @_num_attempts = opts.attempt
            @emit("disconnected", "close") # This just informs everybody that we *are* disconnected.
            conn.removeAllListeners('data')
            log("reconnect scheduled (attempt #{opts.attempt} out of #{opts.retries})")

        conn.on 'reconnect', =>
