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

[rpc module]: possibility to re-use modules on different servers. #328

Closed
niklasad1 opened this issue May 20, 2021 · 1 comment · Fixed by #383
Closed

[rpc module]: possibility to re-use modules on different servers. #328

niklasad1 opened this issue May 20, 2021 · 1 comment · Fixed by #383
Assignees

Comments

@niklasad1
Copy link
Member

The RpcModule doesn't implement Clone and ideally we should some way to construct it once and re-use it to register on several servers such as running the servers on different ports or something similar.

let module = RpcModule::new();
ws_server.register_module(module.clone());
http_server.register_module(module.clone());

Best way is probably to provide some builder that merges the modules when server.start is called.

@niklasad1 niklasad1 changed the title [rpc module]: possibility to re-use module different servers. [rpc module]: possibility to re-use modules on different servers. May 20, 2021
@maciejhirsz
Copy link
Contributor

This should be easily achievable by making the Methods use Arc<HashMap<_, _>> internally, using Arc::make_mut for adding new methods. Sync methods will need to change from Box<dyn _> to Arc<dyn _> like async methods, which should also unlock a straight forward way to do method aliasing (#378).

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 a pull request may close this issue.

2 participants