UNPKG

unifi-client

Version:

NodeJs client for Unifi products (https://www.ui.com/)

53 lines (52 loc) 1.31 kB
/// <reference types="node" /> import { EventEmitter } from 'events'; import type { Controller } from '../Controller'; export interface IUnifiWebSocketsProps { controller: Controller; url: string; strictSSL?: boolean; isController?: boolean; } export declare class UnifiWebsockets extends EventEmitter { private controller; private readonly url; private isClosed; private readonly autoReconnectInterval; private ws; private readonly strictSSL; private pingPongInterval; private isReconnecting; static globalWS: EventEmitter; private readonly isController; private static UnifiWebSockets; constructor(props: IUnifiWebSocketsProps); initWebSockets(): Promise<void>; /** * reconnect to websocket */ private _reconnect; /** * closes all the websockets */ static closeSockets(): void; /** * close this websocket connection */ close(): void; /** * emit an event on multiple events emitter * @param event - an event * @param args - an args */ private _emit; /** * Handle event for a site * @param event - event */ private _handleSiteEvent; /** * globally handle event * @param data - websocket data */ private _handleEvent; }