Created
          June 20, 2011 15:26 
        
      - 
      
- 
        Save dvv/1035818 to your computer and use it in GitHub Desktop. 
    socket.io-node.0.7-transport-naming
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | diff -Naur orig/transports/http.js dvv/transports/http.js | |
| --- orig/transports/http.js 2011-06-20 18:38:21.000000000 +0400 | |
| +++ dvv/transports/http.js 2011-06-20 18:25:54.000000000 +0400 | |
| @@ -42,7 +42,7 @@ | |
| */ | |
| HTTPTransport.prototype.handleRequest = function (req) { | |
| - if (req.method == 'POST') { | |
| + if (req.method === 'POST') { | |
| var buffer = '' | |
| , res = req.res | |
| , self = this; | |
| @@ -74,7 +74,7 @@ | |
| var messages = parser.decodePayload(data); | |
| for (var i = 0, l = messages.length; i < l; i++) { | |
| - this.log.debug('xhr received data packet', data); | |
| + this.log.debug(this.name, 'received data packet', data); | |
| this.onMessage(messages[i]); | |
| } | |
| }; | |
| diff -Naur orig/transports/http-polling.js dvv/transports/http-polling.js | |
| --- orig/transports/http-polling.js 2011-06-20 18:38:21.000000000 +0400 | |
| +++ dvv/transports/http-polling.js 2011-06-17 21:23:14.000000000 +0400 | |
| @@ -25,6 +25,7 @@ | |
| function HTTPPolling (mng, data) { | |
| HTTPTransport.call(this, mng, data); | |
| + this.name = 'xhr'; | |
| }; | |
| /** | |
| diff -Naur orig/transports/jsonp-polling.js dvv/transports/jsonp-polling.js | |
| --- orig/transports/jsonp-polling.js 2011-06-20 18:38:21.000000000 +0400 | |
| +++ dvv/transports/jsonp-polling.js 2011-06-20 18:27:17.000000000 +0400 | |
| @@ -25,6 +25,7 @@ | |
| function JSONPPolling (mng, data) { | |
| HTTPPolling.call(this, mng, data); | |
| + this.name = 'json-polling'; | |
| this.head = 'io.j[0]('; | |
| this.foot = ');'; | |
| @@ -35,7 +36,7 @@ | |
| }; | |
| /** | |
| - * Inherits from Transport. | |
| + * Inherits from HTTPPolling. | |
| */ | |
| JSONPPolling.prototype.__proto__ = HTTPPolling.prototype; | |
| @@ -65,5 +66,5 @@ | |
| }); | |
| this.response.write(data); | |
| - this.log.debug('json-p writing', data); | |
| + this.log.debug(this.name, 'writing', data); | |
| }; | |
| diff -Naur orig/transports/websocket.js dvv/transports/websocket.js | |
| --- orig/transports/websocket.js 2011-06-20 18:38:21.000000000 +0400 | |
| +++ dvv/transports/websocket.js 2011-06-17 18:43:31.000000000 +0400 | |
| @@ -21,8 +21,7 @@ | |
| exports = module.exports = WebSocket; | |
| /** | |
| - * HTTP interface constructor. Interface compatible with all transports that | |
| - * depend on request-response cycles. | |
| + * WebSocket interface constructor. | |
| * | |
| * @api public | |
| */ | |
| @@ -33,7 +32,7 @@ | |
| this.parser = new Parser(); | |
| this.parser.on('data', function (packet) { | |
| - self.log.debug('websocket received data packet', packet); | |
| + self.log.debug(self.name, 'received data packet', packet); | |
| self.onMessage(parser.decodePacket(packet)); | |
| }); | |
| this.parser.on('close', function () { | |
| @@ -44,6 +43,7 @@ | |
| }); | |
| Transport.call(this, mng, data); | |
| + this.name = 'websocket'; | |
| }; | |
| /** | |
| @@ -180,7 +180,7 @@ | |
| this.end(); | |
| } | |
| - this.log.debug('websocket writing', data); | |
| + this.log.debug(this.name, 'writing', data); | |
| } | |
| }; | |
| diff -Naur orig/transports/xhr-polling.js dvv/transports/xhr-polling.js | |
| --- orig/transports/xhr-polling.js 2011-06-20 18:38:21.000000000 +0400 | |
| +++ dvv/transports/xhr-polling.js 2011-06-17 21:22:31.000000000 +0400 | |
| @@ -25,10 +25,11 @@ | |
| function XHRPolling (mng, data) { | |
| HTTPPolling.call(this, mng, data); | |
| + this.name = 'xhr-polling'; | |
| }; | |
| /** | |
| - * Inherits from Transport. | |
| + * Inherits from HTTPPolling. | |
| */ | |
| XHRPolling.prototype.__proto__ = HTTPPolling.prototype; | |
| @@ -60,5 +61,5 @@ | |
| this.response.writeHead(200, headers); | |
| this.response.write(data); | |
| - this.log.debug('xhr-polling writing', data); | |
| + this.log.debug(this.name, 'writing', data); | |
| }; | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment