UNPKG

@darlean/core

Version:

Darlean core functionality for creating applications that define, expose and host actors

28 lines (27 loc) 1.26 kB
import { IDeSer } from '@darlean/utils'; import { ITransportFailure, ITransport, MessageHandler, ITransportSession } from './transport'; import { IRemoteCallTags, ITransportTags } from './wiretypes'; interface IClient { appId: string; onMessage: MessageHandler; } /** * Implements an {@link ITransport} for in-process use (does not support inter-process communication) with support for multiple * apps within the current process. */ export declare class InProcessTransport implements ITransport { protected clients: Map<string, IClient>; protected deser: IDeSer; constructor(deser: IDeSer); connect(appId: string, onMessage: MessageHandler): Promise<ITransportSession>; } export declare class InProcessTransportSession implements ITransportSession { protected appId: string; protected clients: Map<string, IClient>; protected deser: IDeSer; constructor(clients: Map<string, IClient>, deser: IDeSer, appId: string); send(tags: ITransportTags & IRemoteCallTags, contents: unknown, failure?: ITransportFailure): Promise<void>; finalize(): Promise<void>; protected sendFailureMessage(originalTags: ITransportTags & IRemoteCallTags, code: string, msg: string): void; } export {};