UNPKG

nope-js-node

Version:

NoPE Runtime for Nodejs. For Browser-Support please use nope-browser

41 lines (40 loc) 1.46 kB
/** * @author Martin Karkowski * @email m.karkowski@zema.de */ import * as io from "socket.io"; import { ValidLoggerDefinition } from "../../logger/getLogger"; import { EventnameToEventType, ICommunicationBridge, ICommunicationInterface } from "../../types/nope"; import { EventCommunicationInterface } from "./EventCommunicationInterface"; /** * Mirror Layer using IO-Sockets. * * @export * @class IoSocketMirrorClient */ export declare class IoHostLayer extends EventCommunicationInterface { protected _bridge: ICommunicationBridge; port: number; shareData: boolean; protected _sockets: Map<io.Socket, ICommunicationInterface>; protected _openRequests: { [index: string]: number; }; /** * Creates an instance of IoSocketMirrorClient. * @author M.Karkowski * @param {string} uri * @param {ValidLoggerDefinition} [logger="info"] * @memberof IoSocketMirrorClient */ constructor(_bridge: ICommunicationBridge, port: number, logger?: ValidLoggerDefinition, shareData?: boolean); /** * Function, which will be used to emit data * * @param {ValidEventTypesOfMirror} event the name fo the event to emit something * @param {*} data the data to emit * @memberof EventMirror */ emit<T extends keyof EventnameToEventType>(eventname: T, data: EventnameToEventType[T]): Promise<void>; dispose(): Promise<void>; }