UNPKG

@jsonjoy.com/reactive-rpc

Version:

Reactive-RPC is a library for building reactive APIs over WebSocket, HTTP, and other RPCs.

23 lines (22 loc) 929 B
import { type Observable, ReplaySubject } from 'rxjs'; import { StreamingRpcClient, type StreamingRpcClientOptions } from './client/StreamingRpcClient'; import { PersistentChannel, type PersistentChannelParams } from '../channel'; import type { RpcCodec } from '../codec/RpcCodec'; export interface RpcPersistentClientParams { channel: PersistentChannelParams; codec: RpcCodec; client?: Omit<StreamingRpcClientOptions, 'send'>; ping?: number; pingMethod?: string; } export declare class RpcPersistentClient { channel: PersistentChannel; rpc?: StreamingRpcClient; readonly rpc$: ReplaySubject<StreamingRpcClient>; constructor(params: RpcPersistentClientParams); call$(method: string, data: unknown | Observable<unknown>): Observable<unknown>; call(method: string, data: unknown): Promise<unknown>; notify(method: string, data: unknown): void; start(): void; stop(): void; }