@jsonjoy.com/reactive-rpc
Version:
Reactive-RPC is a library for building reactive APIs over WebSocket, HTTP, and other RPCs.
13 lines (12 loc) • 509 B
TypeScript
import type { Observable, Observer, Subject } from 'rxjs';
import type { IStaticRpcMethod, IStreamingRpcMethod } from '../methods/types';
import type { RpcValue } from '../../messages/Value';
export type RpcApiMap<Ctx = unknown> = {
[name: string]: IStaticRpcMethod<Ctx, any, any> | IStreamingRpcMethod<Ctx, any, any>;
};
export interface Call<Req = unknown, Res = unknown> {
req$: Observer<Req>;
reqUnsubscribe$: Observable<null>;
stop$: Subject<null>;
res$: Observable<RpcValue<Res>>;
}