Reactive RPC over WebSocket and HTTP. Both, request and response can be an observable (a stream of data).
type RpcCall = (method: string, payload: Observable<unknown>) => Observable<unknown>;
README-driven-development (stuff below is what it should be like, not what is already implemented:
Similar to gRPC, Reactive-RPC lets you define four kinds of RPC methods:
- Unary RPCs where the client sends a single request to the server and gets a single response back, just like a normal RPC call.
type RpcCall = (method: string, payload: unknown) => Promise<unknown>;
- Server streaming, where the client sends a request to the server and gets a stream to read a sequence of messages back.
type RpcCall = (method: string, payload: unknown) => Observable<unknown>;
- Client streaming RPCs request payload, where the client writes a sequence of messages and sends them to the server.
type RpcCall = (method: string, payload: Observable<unknown>) => Promise<unknown>;
- Bi-directional request and response streaming RPCs, where both sides send a sequence of messages using a read-write stream. The two streams operate independently, so clients and servers can read and write in whatever order they like.
type RpcCall = (method: string, payload: Observable<unknown>) => Observable<unknown>;