UNPKG

@eclipse-ditto/ditto-javascript-client-node

Version:

Node.js(r) implementation of Eclipse Ditto JavaScript API.

62 lines 2.62 kB
/*! * Copyright (c) 2019 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which is available at * http://www.eclipse.org/legal/epl-2.0 * * SPDX-License-Identifier: EPL-2.0 */ import { WebSocketImplementationBuilderUrl } from '../../api/src/client/request-factory/websocket-request-handler'; import { ResponseHandler, WebSocketImplementation, WebSocketImplementationBuilderHandler } from '../../api/src/client/request-factory/resilience/websocket-resilience-interfaces'; import { AuthProvider, DittoURL } from '../../api/src/auth/auth-provider'; import { ProxyAgent } from './proxy-settings'; /** * NodeJs implementation of a web socket requester. */ export declare class NodeWebSocket implements WebSocketImplementation { private webSocket; private readonly webSocketUrl; private readonly handler; private readonly options; private connected; private constructor(); /** * Builds an instance of NodeWebSocket. * * @param url - The Url of the service. * @param handler - The handler that gets called for responses from the web socket. * @param authProviders - The auth providers to use. * @param agent - The proxy agent to use to establish the connection. * @return a Promise for the web socket connection. */ static buildInstance(url: DittoURL, handler: ResponseHandler, authProviders: AuthProvider[], agent: ProxyAgent): Promise<NodeWebSocket>; private static getProxyAgentForProtocol; executeCommand(request: string): void; /** * Reestablishes a failed web socket connection. * * @param retry - The amount of time to wait to reconnect. * @return a Promise for the reestablished web socket connection. */ private reconnect; /** * Sets up the handler so it receives events from the web socket. */ private setHandles; } /** * Builder for the Node implementation of a web socket. */ export declare class NodeWebSocketBuilder implements WebSocketImplementationBuilderUrl, WebSocketImplementationBuilderHandler { private readonly agent; private authProviders; private dittoUrl; constructor(agent: ProxyAgent); withHandler(handler: ResponseHandler): Promise<NodeWebSocket>; withConnectionDetails(url: DittoURL, authProviders: AuthProvider[]): WebSocketImplementationBuilderHandler; } //# sourceMappingURL=node-websocket.d.ts.map