Skip to content
This repository has been archived by the owner on Apr 20, 2024. It is now read-only.

streamich/reactive-rpc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Reactive-RPC

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:

RPC method types

Similar to gRPC, Reactive-RPC lets you define four kinds of RPC methods:

  1. 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>;
  1. 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>;
  1. 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>;
  1. 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>;

About

Rx observables as request/response payloads over WebSocket or HTTP

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published