Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fails with Socket.IO xhr-polling #8

Open
nateps opened this Issue · 1 comment

2 participants

@nateps

Bouncy (technically Parsley) fails reliably when sending data via long-polling with the latest version of Socket.IO (0.8.6). The error occurs reliably in Firefox 3.6 and the Android 2.3 browser (Nexus S).

Note that this example works fine over web sockets using Chrome and Firefox 7, but if they fall back to long-polling, the same error can occur.

Example code:

var server = require('express').createServer(),
    bouncy = require('bouncy'),
    io = require('socket.io').listen(server);

server.get('/', function(req, res) {
  res.send(
    '<script src="/socket.io/socket.io.js"></script>' +
    '<script>' +
    '  var socket = io.connect(":3001");' +
    '  socket.on("connect", function () {' +
    '    socket.emit("test", "yo");' +
    '  });' +
    '</script>'
  );
});

server.listen(3000);

bouncy(function(req, bounce) {
  bounce(3000);
}).listen(3001);

Log:

   info  - socket.io started
   debug - served static content /socket.io.js
   debug - client authorized
   info  - handshake authorized 312045308134228320
   debug - setting request GET /socket.io/1/xhr-polling/312045308134228320?t=1320304185097
   debug - setting poll timeout
   debug - client authorized for 
   debug - clearing poll timeout
   debug - xhr-polling writing 1::
   debug - set close timeout for client 312045308134228320
   debug - xhr-polling received data packet 5:::{"name":"test","args":["yo"]}
   debug - setting request GET /socket.io/1/xhr-polling/312045308134228320?t=1320304185110
   debug - setting poll timeout
   debug - discarding transport
   debug - cleared close timeout for client 312045308134228320

events.js:45
        throw arguments[1]; // Unhandled 'error' event
                       ^
Error: error parsing url
    at Parser.execute (/Users/nateps/Desktop/node_modules/bouncy/node_modules/parsley/index.js:24:27)
    at Socket.<anonymous> (/Users/nateps/Desktop/node_modules/bouncy/node_modules/parsley/index.js:11:14)
    at Socket.emit (events.js:64:17)
    at Socket._onReadable (net.js:678:14)
    at IOWatcher.onReadable [as callback] (net.js:177:10)

Value of this.request when error is emitted:

{ socket: 
   { bufferSize: 0,
     fd: 9,
     type: 'tcp4',
     allowHalfOpen: false,
     _readWatcher: 
      { socket: [Circular],
        callback: [Function: onReadable] },
     destroyed: false,
     readable: true,
     _writeQueue: [],
     _writeQueueEncoding: [],
     _writeQueueFD: [],
     _writeQueueCallbacks: [],
     _writeWatcher: 
      { socket: [Circular],
        callback: [Function: onWritable] },
     writable: true,
     _writeImpl: [Function],
     _readImpl: [Function],
     _shutdownImpl: [Function],
     remoteAddress: '127.0.0.1',
     remotePort: 50164,
     server: 
      { _events: [Object],
        connections: 1,
        allowHalfOpen: false,
        watcher: [Object],
        type: 'tcp4',
        fd: 8 },
     _events: 
      { drain: [Object],
        error: [Object],
        pause: [Object],
        resume: [Object],
        end: [Object],
        close: [Object] },
     _pipeCount: 5 },
  connection: 
   { bufferSize: 0,
     fd: 9,
     type: 'tcp4',
     allowHalfOpen: false,
     _readWatcher: 
      { socket: [Circular],
        callback: [Function: onReadable] },
     destroyed: false,
     readable: true,
     _writeQueue: [],
     _writeQueueEncoding: [],
     _writeQueueFD: [],
     _writeQueueCallbacks: [],
     _writeWatcher: 
      { socket: [Circular],
        callback: [Function: onWritable] },
     writable: true,
     _writeImpl: [Function],
     _readImpl: [Function],
     _shutdownImpl: [Function],
     remoteAddress: '127.0.0.1',
     remotePort: 50164,
     server: 
      { _events: [Object],
        connections: 1,
        allowHalfOpen: false,
        watcher: [Object],
        type: 'tcp4',
        fd: 8 },
     _events: 
      { drain: [Object],
        error: [Object],
        pause: [Object],
        resume: [Object],
        end: [Object],
        close: [Object] },
     _pipeCount: 5 },
  httpVersion: null,
  complete: false,
  headers: {},
  trailers: {},
  readable: true,
  url: 'localhost:3001\r',
  method: 'HOST:',
  statusCode: null,
  client: 
   { bufferSize: 0,
     fd: 9,
     type: 'tcp4',
     allowHalfOpen: false,
     _readWatcher: 
      { socket: [Circular],
        callback: [Function: onReadable] },
     destroyed: false,
     readable: true,
     _writeQueue: [],
     _writeQueueEncoding: [],
     _writeQueueFD: [],
     _writeQueueCallbacks: [],
     _writeWatcher: 
      { socket: [Circular],
        callback: [Function: onWritable] },
     writable: true,
     _writeImpl: [Function],
     _readImpl: [Function],
     _shutdownImpl: [Function],
     remoteAddress: '127.0.0.1',
     remotePort: 50164,
     server: 
      { _events: [Object],
        connections: 1,
        allowHalfOpen: false,
        watcher: [Object],
        type: 'tcp4',
        fd: 8 },
     _events: 
      { drain: [Object],
        error: [Object],
        pause: [Object],
        resume: [Object],
        end: [Object],
        close: [Object] },
     _pipeCount: 5 },
  _events: 
   { rawHead: [Function: onData],
     rawBody: [Function: onData],
     rawEnd: [Function],
     headers: [Function: onHeaders],
     error: { [Function: g] listener: [Function: onError] } } }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.