Don't clobber over the event emitters _callbacks
authorDarren <darren@darrenwhitlen.com>
Sun, 1 Sep 2013 13:09:34 +0000 (14:09 +0100)
committerDarren <darren@darrenwhitlen.com>
Sun, 1 Sep 2013 13:18:22 +0000 (14:18 +0100)
client/assets/libs/engine.io.tools.js
server/websocketrpc.js

index 9852e8a0f2aa7f8555ef5d21969aa3664658b2ae..8e7c26498104a9efb981bf29ed0e02de815a1ffd 100644 (file)
@@ -111,7 +111,7 @@ var EngineioTools = {
             var self = this;
 
             this._next_id = 0;
-            this._callbacks = {};
+            this._rpc_callbacks = {};
             this._socket = eio_socket;
 
             this._mixinEmitter();
@@ -203,7 +203,7 @@ var EngineioTools = {
                 packet.id = this._next_id;
 
                 this._next_id++;
-                this._callbacks[packet.id] = callback;
+                this._rpc_callbacks[packet.id] = callback;
             }
 
             this.send(packet);
@@ -236,12 +236,12 @@ var EngineioTools = {
 
             if (this._isResponse(packet)) {
                 // If we have no callback waiting for this response, don't do anything
-                if (typeof this._callbacks[packet.id] !== 'function')
+                if (typeof this._rpc_callbacks[packet.id] !== 'function')
                     return;
 
                 // Call and delete this callback once finished with it
-                this._callbacks[packet.id].apply(this, packet.response);
-                delete this._callbacks[packet.id];
+                this._rpc_callbacks[packet.id].apply(this, packet.response);
+                delete this._rpc_callbacks[packet.id];
 
             } else if (this._isCall(packet)) {
                 // Calls with an ID may be responded to
index 01c3ef9f434a5171f19f08353d61894398f2c4ee..974301824015d30398e85736cf9c4e8b5bc1c190 100644 (file)
@@ -8,7 +8,7 @@ function WebsocketRpc(eio_socket) {
     var self = this;
 
     this._next_id = 0;
-    this._callbacks = {};
+    this._rpc_callbacks = {};
     this._socket = eio_socket;
 
     this._mixinEmitter();
@@ -100,7 +100,7 @@ WebsocketRpc.prototype.call = function(method) {
         packet.id = this._next_id;
 
         this._next_id++;
-        this._callbacks[packet.id] = callback;
+        this._rpc_callbacks[packet.id] = callback;
     }
 
     this.send(packet);
@@ -133,12 +133,12 @@ WebsocketRpc.prototype._onMessage = function(message_raw) {
 
     if (this._isResponse(packet)) {
         // If we have no callback waiting for this response, don't do anything
-        if (typeof this._callbacks[packet.id] !== 'function')
+        if (typeof this._rpc_callbacks[packet.id] !== 'function')
             return;
 
         // Call and delete this callback once finished with it
-        this._callbacks[packet.id].apply(this, packet.response);
-        delete this._callbacks[packet.id];
+        this._rpc_callbacks[packet.id].apply(this, packet.response);
+        delete this._rpc_callbacks[packet.id];
 
     } else if (this._isCall(packet)) {
         // Calls with an ID may be responded to