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

make it possible to use a regexp to match the socket.io resource URL #744

Merged
merged 1 commit into from Feb 9, 2012
Merged

make it possible to use a regexp to match the socket.io resource URL #744

merged 1 commit into from Feb 9, 2012

Conversation

fjakobs
Copy link
Contributor

@fjakobs fjakobs commented Feb 9, 2012

We need this because we have to prefix the socket.io URL with a variable
ID.

socket.io resource URL. We need this because we
have to prefix the socket.io URL with a variable
ID.
@fjakobs
Copy link
Contributor Author

fjakobs commented Feb 9, 2012

In Cloud9 we shard IDE workspaces based on the workspace id (e.g. fjakobs/ace) to different backend servers. Dispatching is done based on a URL prefix e.g. /fjakobs/ace/...

I want to attach the socket.io URL below these prefixes /fjakobs/ace/socket.io
With this patch I can easily do that with one socket.io instance by using a regexp as resource:

socketIo.listen(server, {
    resource: /^(?:\/[\w\d_\-]+){2}\/socket\.io/
})

@rauchg
Copy link
Contributor

rauchg commented Feb 9, 2012

Oh sounds good!

rauchg added a commit that referenced this pull request Feb 9, 2012
make it possible to use a regexp to match the socket.io resource URL
@rauchg rauchg merged commit 8c1c7a2 into socketio:master Feb 9, 2012
@rauchg
Copy link
Contributor

rauchg commented Feb 9, 2012

In the next major version I'll explain how to also pass requests without listen, in a way that you can capture with completely arbitrary rules. This is already possible in engine.io/websocket.io by calling handleRequest/handleUpgrade and passing the request/upgraded request objects.

However, having the regexp is definitely handly. Thanks!

@fjakobs
Copy link
Contributor Author

fjakobs commented Feb 10, 2012

being able to pass requests without listen would be really handy. Thanks for the pull.

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

Successfully merging this pull request may close these issues.

None yet

2 participants