UNPKG

lisk-framework

Version:

Lisk blockchain application platform

46 lines (45 loc) 1.78 kB
/// <reference types="node" /> import { ListenerFn } from 'eventemitter2'; import { Logger } from '../logger'; import { EndpointInfo } from '../types'; import { BaseChannel, InvokeRequest } from './channels/base_channel'; import { EventsDefinition } from './event'; import { IPCServer } from './ipc/ipc_server'; import * as JSONRPC from './jsonrpc'; interface BusConfiguration { readonly internalIPCServer: IPCServer; readonly chainID: Buffer; } interface RegisterChannelOptions { readonly type: string; readonly channel: BaseChannel; readonly socketPath?: string; } export declare class Bus { private readonly _endpointInfos; private readonly _events; private readonly _channels; private readonly _rpcClients; private readonly _internalIPCServer; private readonly _rpcRequestIds; private readonly _emitter; private readonly _handleRPCResponse; private readonly _handleRPC; private readonly _handleEvents; private _logger; constructor(config: BusConfiguration); start(logger: Logger): Promise<void>; registerChannel(namespace: string, events: EventsDefinition, endpointInfo: { [key: string]: EndpointInfo; }, options: RegisterChannelOptions): Promise<void>; invoke<T>(rawRequest: string | JSONRPC.RequestObject, context?: InvokeRequest['context']): Promise<JSONRPC.ResponseObjectWithResult<T>>; publish(rawRequest: string | JSONRPC.NotificationRequest): void; subscribe(eventName: string, cb: ListenerFn): void; unsubscribe(eventName: string, cb: ListenerFn): void; once(eventName: string, cb: ListenerFn): this; getEndpoints(): ReadonlyArray<string>; getEvents(): ReadonlyArray<string>; cleanup(): Promise<void>; private _setupIPCInternalServer; } export {};