Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Socket.IO does not intercept first client file request #66

Closed
jed opened this issue Oct 4, 2010 · 1 comment
Closed

Socket.IO does not intercept first client file request #66

jed opened this issue Oct 4, 2010 · 1 comment

Comments

@jed
Copy link
Contributor

jed commented Oct 4, 2010

It looks like Socket.IO fails to intercept the first request for the client files when it is added as a listener after another app.

so assuming that

function app( req, res ) {
  res.writeHead( 200, {} );
  res.end( "done." );
}

this will serve successfully:

var server = require( "http" ).createServer( app )
  , socket = require( "socket.io" ).listen( server );

server.listen( 8000 );

but this will result in a 404 for the first request only, and serve successfully on subsequent requests:

var server = require( "http" ).createServer()
  , socket = require( "socket.io" ).listen( server );

server.listen( 8000 );

server.on( "request", app );
@kevinwritescode
Copy link

I'm not sure if this is entirely related, but I just had to do a patch on my socket.io fork to prevent it from setting the request to null in client._onClose so I could pass a request through the Connect app. This feels like a hack, but along with stopping the unsetting of this.request, I added removeAllEventListeners before AddEventListener to deal with memory issues on the now persistent request.

https://github.com/KevinNuut/Socket.IO-node/commit/4b4cda2b2f0819a1c65b9710f6679092b2f0694b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants