UNPKG

@jsonjoy.com/reactive-rpc

Version:

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

24 lines (23 loc) 974 B
import { type StaticRpcClientOptions } from './StaticRpcClient'; import { EncodedStaticRpcClient } from './EncodedStaticRpcClient'; import type { RpcMessageCodec } from '../../codec/types'; import type { JsonValueCodec } from '@jsonjoy.com/json-pack/lib/codecs/types'; import type { Observable } from 'rxjs'; import type { RpcClient } from './types'; type IFetch = typeof fetch; export interface FetchRpcClientOptions extends StaticRpcClientOptions { url: string; msgCodec: RpcMessageCodec; reqCodec: JsonValueCodec; resCodec?: JsonValueCodec; fetch?: IFetch; } export declare class FetchRpcClient implements RpcClient { readonly client: EncodedStaticRpcClient; constructor(options: FetchRpcClientOptions); call$(method: string, data: unknown | Observable<unknown>): Observable<unknown>; call(method: string, request: unknown): Promise<unknown>; notify(method: string, data: undefined | unknown): void; stop(): void; } export {};