From 3343212821f3622178c0f71ebd6d90f801c50c84 Mon Sep 17 00:00:00 2001 From: Darren Date: Fri, 30 Aug 2013 12:06:26 +0100 Subject: [PATCH] Engine.io + Engine.io.tools implemented --- client/assets/libs/websocketrpc.js | 164 ---------------------------- client/assets/src/build.js | 38 +++++++ client/assets/src/models/gateway.js | 6 +- server/httphandler.js | 11 +- 4 files changed, 48 insertions(+), 171 deletions(-) delete mode 100644 client/assets/libs/websocketrpc.js diff --git a/client/assets/libs/websocketrpc.js b/client/assets/libs/websocketrpc.js deleted file mode 100644 index 01554f8..0000000 --- a/client/assets/libs/websocketrpc.js +++ /dev/null @@ -1,164 +0,0 @@ -/* - Create a document explaining the protocol -*/ - -function WebsocketRpc(eio_socket) { - var self = this; - - this._next_id = 0; - this._callbacks = {}; - this._socket = eio_socket; - - this._mixinEmitter(); - this._bindSocketListeners(); -} - - -WebsocketRpc.prototype._bindSocketListeners = function() { - var self = this; - - // Proxy the onMessage listener - this._onMessageProxy = function rpcOnMessageBoundFunction(){ - self._onMessage.apply(self, arguments); - }; - this._socket.on('message', this._onMessageProxy); -}; - - - -WebsocketRpc.prototype.dispose = function() { - if (this._onMessageProxy) { - this._socket.removeListener('message', this._onMessageProxy); - delete this._onMessageProxy; - } - - this.removeAllListeners(); -}; - - - - -/** - * The engine.io socket already has an emitter mixin so steal it from there - */ -WebsocketRpc.prototype._mixinEmitter = function() { - var funcs = ['on', 'once', 'off', 'removeListener', 'removeAllListeners', 'emit', 'listeners', 'hasListeners']; - - for (var i=0; i