UNPKG

node-jet

Version:

Jet Realtime Message Bus for the Web. Daemon and Peer implementation.

25 lines (24 loc) 1 kB
import type JsonRPC from '../../2_jsonrpc/index.js'; import type { FetchParams, MethodParams } from '../messages.js'; import type { ValueType } from '../types.js'; import type { Route } from './route.js'; /** A subscription corresponds to a fetch request. * Each subscription contains all the routes that match the subscription */ export declare class Subscription { owner?: JsonRPC; id: string; messages: MethodParams[]; routes: Route[]; pathMatcher: (path: string) => boolean; valueMatcher: (value: ValueType | undefined) => boolean; constructor(msg: FetchParams, peer?: JsonRPC | undefined); close: () => void; handleChange: (path: string, value: ValueType) => void; handleRemove: (path: string) => void; addRoute: (route: Route) => void; setRoutes: (routes: Route[]) => void; matchesPath: (path: string) => boolean; matchesValue: (value: ValueType | undefined) => boolean; enqueue: (msg: MethodParams) => void; send: () => void; }