UNPKG

@atomist/automation-client

Version:

Atomist API for software low-level client

65 lines 1.56 kB
import * as WebSocket from "ws"; export interface WebSocketLifecycle { /** * Set the WebSocket to manage * @param ws */ set(ws: WebSocket): void; /** * Is the WebSocket is connected and healthy */ connected(): boolean; /** * Get the raw WebSocket that is managed here */ get(): WebSocket; /** * Reset the WebSocket */ reset(): void; /** * Send a message over the managed WebSocket * If the WebSocket isn't connected, messages are queued for later * when a WebSocket is connected again. * @param msg */ send(msg: any): void; } /** * Lifecycle owning a WebSocket connection wrt message sending */ export declare class QueuingWebSocketLifecycle implements WebSocketLifecycle { private readonly messages; private ws; private timer; constructor(); /** * Set the WebSocket to manage * @param ws */ set(ws: WebSocket): void; /** * Is the WebSocket is connected and healthy */ connected(): boolean; /** * Get the raw WebSocket that is managed here */ get(): WebSocket; /** * Reset the WebSocket */ reset(): void; /** * Send a message over the managed WebSocket * If the WebSocket isn't connected, messages are queued for later * when a WebSocket is connected again. * @param msg */ send(msg: any): void; /** * Init the internal queue processing */ private init; } //# sourceMappingURL=WebSocketLifecycle.d.ts.map