UNPKG

botframework-streaming

Version:

Streaming library for the Microsoft Bot Framework

54 lines 2.27 kB
/** * @module botframework-streaming */ /** * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. */ import { RequestHandler } from '../requestHandler'; import { StreamingRequest } from '../streamingRequest'; import { IStreamingTransportClient, IReceiveResponse } from '../interfaces'; /** * Web socket based client to be used as streaming transport. */ export declare class WebSocketClient implements IStreamingTransportClient { private readonly _url; private readonly _requestHandler; private readonly _sender; private readonly _receiver; private readonly _requestManager; private readonly _protocolAdapter; private readonly _disconnectionHandler; /** * Creates a new instance of the [WebSocketClient](xref:botframework-streaming.WebSocketClient) class. * * @param config For configuring a [WebSocketClient](xref:botframework-streaming.WebSocketClient) instance to communicate with a WebSocket server. * @param config.url The URL of the remote server to connect to. * @param config.requestHandler The [RequestHandler](xref:botframework-streaming.RequestHandler) used to process incoming messages received by this client. * @param config.disconnectionHandler Optional function to handle the disconnection message. */ constructor({ url, requestHandler, disconnectionHandler, }: { url: string; requestHandler: RequestHandler; disconnectionHandler: (message: string) => void; }); /** * Establish a connection with no custom headers. * * @returns A promise that will not resolve until the client stops listening for incoming messages. */ connect(): Promise<void>; /** * Stop this client from listening. */ disconnect(): void; /** * Task used to send data over this client connection. * * @param request The [StreamingRequest](xref:botframework-streaming.StreamingRequest) instance to send. * @returns A promise that will produce an instance of receive response on completion of the send operation. */ send(request: StreamingRequest): Promise<IReceiveResponse>; private onConnectionDisconnected; } //# sourceMappingURL=nodeWebSocketClient.d.ts.map