johanhelsing / matchbox

Painless peer-to-peer WebRTC networking for rust wasm (and native!)
Apache License 2.0
918 stars 76 forks source link

Add construct_router function #447

Open RaoulHC opened 7 months ago

RaoulHC commented 7 months ago

If you want to use a single server and have matchbox signalling at a specific route it's useful to be able to get the router directly and work with that. You can't use mutate_router as that occurs before the final router construction and you'll likely end up with conflicting routes. I don't think you can expose a constructed IntoMakeServiceWithConnectInfo as that can't be merged/nested into another router, it just has to be called at the root level before use.

Open to other suggestions to how to do this, but this seems like the most straight forward and flexible way to do it.

I also loosened the traits for mutate_router which I didn't end up needing, but it is more restrictive than necessary.

RaoulHC commented 3 months ago

I've rebased this, @simbleau could you take a look?