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 on Router + Slab:
Todo
[x] Provide an extractor for the connect handler to get path parameters
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 theslab
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