Regular expression & check function support for checking routes#76
Regular expression & check function support for checking routes#76cadorn wants to merge 9 commits intosocketio:masterfrom cloud9ide:dynamic-routes
Conversation
lib/engine.io.js
Outdated
There was a problem hiding this comment.
Thanks, I was looking at this yesterday and was thinking of simplifying
|
Hmm, this may need a bit more work. In our use-case we register many instances of engine.io at different paths/routes on the same server and are getting this warning: The problem is here: https://github.com/LearnBoost/engine.io/blob/fefb643c4a6ff77d38571e2bc5832cd0a471f840/lib/engine.io.js#L147 Where many listeners are attached to the same server. Looks like we need one listener per server and then check routes before delegating to engine.io instance. Any suggestions on how that should best be done? I would be happy to take a stab at it. |
|
Alright, all fixed. Let me know what needs to change for this to land. |
|
It looks good, but |
It does not look pretty but kind of all belongs into
We attach many engine.io instances at different paths to same server. If no |
|
How many instances do you have? |
|
Not 100% sure but >1k possibly as high as 5k. |
|
What's the benefit over having one instance with a regexp? |
|
I suppose its a limitation of our wrapper. We would need the Can that be done? I have not looked at the engine.io code too closely. With that change we could lower |
|
Yeah, keep in mind per SPEC engine.io also gives flexibility with the query string. You can pass arbitrary data related to the connection there too. |
|
In a way I would say the "path" is a special engine.io thing, almost not user-land. The main reason for this is that otherwise we're almost introducing a pseudo/limited router in an |
|
Ok, I'll fix our wrapper and set the limit to 100. |
|
I'm also curious as to why retaining |
|
Also in a way you break the "contract" with other software that could be looking at your requests to determine what kind they are. Since we can't set a header "X-Requested-With: Engine" or "X-Engine-IO", the only way external components could know engine is in place is by looking at the path. For example, I believe http://nodetime.com/ looks for "/socket.io" to give you socket.io analytics. |
|
@cadorn I think what we should give the flexibility of regular expressions / functions / etc is the |
|
We currently only load balance based on the path. I suppose that can be updated to look at the query string as well. |
|
I'll fix our wrapper to create only one engine.io instance and use the resource instead of path to register a dynamic route. We can then land this and you can make the path immutable. |
|
Feels much cleaner. Made the |
|
Let's do a smaller pull request first that just adds regular expression / function support for Then we'll address the approach to multiple attachments to the same server. This pull request does too much and it's hard to review. |
|
I can do this but it will take some time. |
|
@cadorn the test "server close should trigger on client if server does not meet ping timeout" fails a lot, from your other pull request |
|
Hmm. Seems to be fine for me. Any way I can reproduce your environment? What is the failure message? |
|
Created separate issues. |
See: #67