mafintosh / router

a lean and mean http router for node.js
66 stars 14 forks source link

Router + socket.io #8

Open IngwiePhoenix opened 10 years ago

IngwiePhoenix commented 10 years ago

Hey.

I would like to know if there is a way to get around using this hackery:

router.all("/socket.io/*",function(){
    // Do NOT respond here. This is socket.io property.
});

Mainly, I had the idea that router could/should feature two things:

The first could be implemented by passing the object that socket.io returns upon creation to router, so it can query it for the path that socket.io expects.

For the latter I thought there could be a simple one-liner like:

router.noResponse("/somePath", [errorCode]);

To make router not respond, or respond with the specied error code instead.

Is that possible?

Kind regards, Ingwie.