UNPKG

@mdf.js/socket-client-provider

Version:

MMS - Socket.io Client Port for Javascript/Typescript

44 lines 1.69 kB
/** * Copyright 2024 Mytra Control S.L. All rights reserved. * * Use of this source code is governed by an MIT-style license that can be found in the LICENSE file * or at https://opensource.org/licenses/MIT. */ import { Layer } from '@mdf.js/core'; import { LoggerInstance } from '@mdf.js/logger'; import { Client, Config } from './types'; export declare class Port extends Layer.Provider.Port<Client, Config> { /** Client handler */ private readonly instance; /** * Implementation of functionalities of an HTTP client port instance. * @param config - Port configuration options * @param logger - Port logger, to be used internally */ constructor(config: Config, logger: LoggerInstance); /** Return the underlying port instance */ get client(): Client; /** Return the port state as a boolean value, true if the port is available, false in otherwise */ get state(): boolean; /** Initialize the port instance */ start(): Promise<void>; /** Stop the port instance */ stop(): Promise<void>; /** Close the port instance */ close(): Promise<void>; /** Event handler for the `connect` event */ private readonly onConnectEvent; /** Event handler for the `disconnect` event */ private readonly onDisconnectEvent; /** * Adapts the `client` instance events to standard Port events * @param instance - Client instance over which the events should be wrapped */ private eventsWrapping; /** * Clean all the events handlers * @param instance - Client instance over which the events should be cleaned */ private eventsUnwrapping; } //# sourceMappingURL=Port.d.ts.map