-
Notifications
You must be signed in to change notification settings - Fork 18
Description
Hello! While using Remoc in my application, I realized that some connection logic was duplicated:
- I need to implement some basic connection logic each time I create a server/client type. This includes for example graceful shutdown or automatic reconnection.
- I use Remoc to communicate between multiple services, where each service handles a single task. Therefore, all my Remoc servers send a channel or a rtc client as soon as the connection is created. Other channels may be created later, but the base channel is only used to send a more appropriate type.
I think these use cases are quite common, so I propose to include types to make their implementation easier:
- Allow to initialize a connection with other types than base channel, for example directly with an RPC server/client or a broadcast channel. Maybe create
Handlertraits with methods that will be called directly after a connection is established. - Implement generic
ClientandServertypes that are configured with a specific transport and handler, and manage the connection. This includes graceful shutdown and automatic reconnection, for example. - Abstract transports with a
Transporttrait, that could be used inConnector directly with aServer/Client. Implementation for common transports such as TCP may be provided.
Built-in handlers for common usages such as RPC or broadcasting stream may be provided.
I think adding features like this would make remoc much easier to use by hiding some things that may seem complex to beginners, without sacrificing the flexibility of the library, since all these features would be optional, and could even be used partially. Remoc is a project that can be useful to many people and fulfills many use cases. Making it easier to get started with would in my opinion make it much more used and would make it a serious alternative to tarpc or tonic.