-
-
Notifications
You must be signed in to change notification settings - Fork 56
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
feat: namespace routing #333
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Totodore
force-pushed
the
feat-namespace-routing
branch
from
June 19, 2024 10:53
56e37ba
to
1fe085c
Compare
Totodore
force-pushed
the
feat-namespace-routing
branch
from
June 19, 2024 13:57
1fe085c
to
4d210b5
Compare
Totodore
force-pushed
the
feat-namespace-routing
branch
from
June 24, 2024 11:12
f3c18b0
to
c7a94b5
Compare
Totodore
force-pushed
the
feat-namespace-routing
branch
3 times, most recently
from
June 24, 2024 13:12
b5bd1d7
to
302e2a2
Compare
Totodore
force-pushed
the
feat-namespace-routing
branch
2 times, most recently
from
June 24, 2024 13:25
6c1c61c
to
a5c260d
Compare
Totodore
force-pushed
the
feat-namespace-routing
branch
from
June 24, 2024 13:26
a5c260d
to
f0d7fc9
Compare
Totodore
force-pushed
the
feat-namespace-routing
branch
from
June 24, 2024 15:46
f0d7fc9
to
9df042f
Compare
After multiple experimentations and attempts to solve this problem I decided to report the following features for future PRs:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
Adding Namespace routing would allow to add a layer of multiplexing and also match the features of the official socket.io client.
Close issue #212.
Solution
Because I think that a regex based solution is way to slow and overkill for a simple router feature, the routing is implemented using the matchit crate. This allow to have a simple syntax for path parameters:
/admin/{id}/board
and even wildcards/admin/{*path}
.One of the main drawbacks is the need of an adjacent buffer to store namespace because it is not possible to iterate over the path /values of the router. So currently this is using the
slab
crate from tokio to store namespace and the router only stores indexes.Performance
Here are some benchmark results to compare previous
Hashmap
based implementation with the new based onRouter
+Slab
:Todo