diff --git a/libraries/botbuilder-dialogs-adaptive-runtime-integration-express/src/index.ts b/libraries/botbuilder-dialogs-adaptive-runtime-integration-express/src/index.ts index 674c7e58d1..e9560c934d 100644 --- a/libraries/botbuilder-dialogs-adaptive-runtime-integration-express/src/index.ts +++ b/libraries/botbuilder-dialogs-adaptive-runtime-integration-express/src/index.ts @@ -207,8 +207,7 @@ export async function makeApp( const adapter = services.mustMakeInstance('adapter'); try { - // TODO: Fix INodeSocket type. Related issue https://github.com/microsoft/botbuilder-js/issues/4684. - await adapter.process(req, socket as any, head, async (context) => { + await adapter.process(req, socket, head, async (context) => { await bot.run(context); }); } catch (err: any) { diff --git a/libraries/botbuilder-dialogs-adaptive-runtime-integration-restify/src/index.ts b/libraries/botbuilder-dialogs-adaptive-runtime-integration-restify/src/index.ts index e1082d8d7d..b9fddd2ddb 100644 --- a/libraries/botbuilder-dialogs-adaptive-runtime-integration-restify/src/index.ts +++ b/libraries/botbuilder-dialogs-adaptive-runtime-integration-restify/src/index.ts @@ -194,8 +194,7 @@ export async function makeServer( const adapter = services.mustMakeInstance('adapter'); try { - // TODO: Fix INodeSocket type. Related issue https://github.com/microsoft/botbuilder-js/issues/4684. - await adapter.process(req, socket as any, head, async (context) => { + await adapter.process(req, socket, head, async (context) => { await bot.run(context); }); } catch (err: any) { diff --git a/libraries/botbuilder/etc/botbuilder.api.md b/libraries/botbuilder/etc/botbuilder.api.md index 20b9ab18f4..b2c5138a13 100644 --- a/libraries/botbuilder/etc/botbuilder.api.md +++ b/libraries/botbuilder/etc/botbuilder.api.md @@ -45,6 +45,7 @@ import { HttpClient } from '@azure/core-http'; import { HttpOperationResponse } from '@azure/core-http'; import { ICredentialProvider } from 'botframework-connector'; import { INodeBuffer } from 'botframework-streaming'; +import { INodeDuplex } from 'botframework-streaming'; import { INodeSocket } from 'botframework-streaming'; import { InvokeResponse } from 'botbuilder-core'; import { IReceiveRequest } from 'botframework-streaming'; @@ -187,6 +188,7 @@ export interface BotFrameworkAdapterSettings { export interface BotFrameworkHttpAdapter { process(req: Request_2, res: Response_2, logic: (context: TurnContext) => Promise): Promise; process(req: Request_2, socket: INodeSocket, head: INodeBuffer, logic: (context: TurnContext) => Promise): Promise; + process(req: Request_2, socket: INodeDuplex, head: INodeBuffer, logic: (context: TurnContext) => Promise): Promise; } // @public @deprecated (undocumented) @@ -250,6 +252,7 @@ export class CloudAdapter extends CloudAdapterBase implements BotFrameworkHttpAd connectNamedPipe(pipeName: string, logic: (context: TurnContext) => Promise, appId: string, audience: string, callerId?: string, retryCount?: number): Promise; process(req: Request_2, res: Response_2, logic: (context: TurnContext) => Promise): Promise; process(req: Request_2, socket: INodeSocket, head: INodeBuffer, logic: (context: TurnContext) => Promise): Promise; + process(req: Request_2, socket: INodeDuplex, head: INodeBuffer, logic: (context: TurnContext) => Promise): Promise; processActivityDirect(authorization: string | AuthenticateRequestResult, activity: Activity, logic: (context: TurnContext) => Promise): Promise; } diff --git a/libraries/botbuilder/src/botFrameworkHttpAdapter.ts b/libraries/botbuilder/src/botFrameworkHttpAdapter.ts index 42806c72d2..5e174b67db 100644 --- a/libraries/botbuilder/src/botFrameworkHttpAdapter.ts +++ b/libraries/botbuilder/src/botFrameworkHttpAdapter.ts @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -import type { INodeBuffer, INodeSocket } from 'botframework-streaming'; +import type { INodeBuffer, INodeDuplex, INodeSocket } from 'botframework-streaming'; import type { Request, Response } from './interfaces'; import type { TurnContext } from 'botbuilder-core'; @@ -26,4 +26,15 @@ export interface BotFrameworkHttpAdapter { head: INodeBuffer, logic: (context: TurnContext) => Promise ): Promise; + + /** + * Handle a web socket connection by applying a logic callback function to + * each streaming request. + */ + process( + req: Request, + socket: INodeDuplex, + head: INodeBuffer, + logic: (context: TurnContext) => Promise + ): Promise; } diff --git a/libraries/botbuilder/src/cloudAdapter.ts b/libraries/botbuilder/src/cloudAdapter.ts index 16db792401..c914aa8f93 100644 --- a/libraries/botbuilder/src/cloudAdapter.ts +++ b/libraries/botbuilder/src/cloudAdapter.ts @@ -26,6 +26,7 @@ import { import { INodeBuffer, INodeSocket, + INodeDuplex, IReceiveRequest, IReceiveResponse, IStreamingTransportServer, @@ -80,12 +81,29 @@ export class CloudAdapter extends CloudAdapterBase implements BotFrameworkHttpAd logic: (context: TurnContext) => Promise ): Promise; + /** + * Handle a web socket connection by applying a logic function to + * each streaming request. + * + * @param req An incoming HTTP [Request](xref:botbuilder.Request) + * @param socket The corresponding [INodeDuplex](xref:botframework-streaming.INodeDuplex) + * @param head The corresponding [INodeBuffer](xref:botframework-streaming.INodeBuffer) + * @param logic The logic function to apply + * @returns a promise representing the asynchronous operation. + */ + async process( + req: Request, + socket: INodeDuplex, + head: INodeBuffer, + logic: (context: TurnContext) => Promise + ): Promise; + /** * @internal */ async process( req: Request, - resOrSocket: Response | INodeSocket, + resOrSocket: Response | INodeSocket | INodeDuplex, logicOrHead: ((context: TurnContext) => Promise) | INodeBuffer, maybeLogic?: (context: TurnContext) => Promise ): Promise { diff --git a/libraries/botframework-streaming/etc/botframework-streaming.api.md b/libraries/botframework-streaming/etc/botframework-streaming.api.md index 3998d1991a..83fac7132c 100644 --- a/libraries/botframework-streaming/etc/botframework-streaming.api.md +++ b/libraries/botframework-streaming/etc/botframework-streaming.api.md @@ -8,6 +8,7 @@ import { Duplex } from 'stream'; import { DuplexOptions } from 'stream'; +import { Socket } from 'net'; import { default as WebSocket_2 } from 'ws'; // @public @@ -144,6 +145,14 @@ export interface INodeBuffer extends Uint8Array { writeUIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; } +// @public +export interface INodeDuplex extends Duplex { + // (undocumented) + on(event: string | symbol, listener: (...args: any[]) => void): this; + // (undocumented) + on(event: 'data', listener: (chunk: INodeBuffer) => void): this; +} + // @public export interface INodeIncomingMessage { headers?: any; @@ -151,218 +160,11 @@ export interface INodeIncomingMessage { } // @public -export interface INodeSocket { - // (undocumented) - [Symbol.asyncIterator](): AsyncIterableIterator; - // (undocumented) - addListener(event: 'close', listener: () => void): this; - // (undocumented) - addListener(event: 'data', listener: (chunk: any) => void): this; - // (undocumented) - addListener(event: 'end', listener: () => void): this; - // (undocumented) - addListener(event: 'readable', listener: () => void): this; - // (undocumented) - addListener(event: 'error', listener: (err: Error) => void): this; - // (undocumented) - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - // Warning: (ae-forgotten-export) The symbol "AddressInfo" needs to be exported by the entry point index.d.ts - // - // (undocumented) - address(): AddressInfo | string; - // (undocumented) - readonly bufferSize: number; - // (undocumented) - readonly bytesRead: number; - // (undocumented) - readonly bytesWritten: number; - // (undocumented) - connect(options: any, connectionListener?: () => void): any; - // (undocumented) - connect(port: number, host: string, connectionListener?: () => void): any; - // (undocumented) - connect(port: number, connectionListener?: () => void): any; - // (undocumented) - connect(path: string, connectionListener?: () => void): any; - // (undocumented) - connecting: boolean; - // (undocumented) - cork(): void; - // (undocumented) - destroy(error?: Error): void; - // (undocumented) - _destroy(error: Error | null, callback: (error: Error | null) => void): void; - // (undocumented) - destroyed: boolean; - // (undocumented) - emit(event: 'close'): boolean; - // (undocumented) - emit(event: 'data', chunk: any): boolean; - // (undocumented) - emit(event: 'end'): boolean; - // (undocumented) - emit(event: 'readable'): boolean; - // (undocumented) - emit(event: 'error', err: Error): boolean; - // (undocumented) - emit(event: string | symbol, ...args: any[]): boolean; - // (undocumented) - end(cb?: () => void): void; - // (undocumented) - end(chunk: any, cb?: () => void): void; - // (undocumented) - end(chunk: any, encoding?: string, cb?: () => void): void; - // (undocumented) - eventNames(): Array; - // (undocumented) - _final(callback: (error?: Error | null) => void): void; - // (undocumented) - getMaxListeners(): number; - // (undocumented) - isPaused(): boolean; - // (undocumented) - listenerCount(type: string | symbol): number; - // (undocumented) - listeners(event: string | symbol): Function[]; - // (undocumented) - readonly localAddress: string; - // (undocumented) - readonly localPort: number; - // (undocumented) - off(event: string | symbol, listener: (...args: any[]) => void): this; +export interface INodeSocket extends Socket { // (undocumented) on(event: string, listener: (...args: any[]) => void): this; // (undocumented) - on(event: 'close', listener: (had_error: boolean) => void): this; - // (undocumented) - on(event: 'connect', listener: () => void): this; - // (undocumented) on(event: 'data', listener: (data: INodeBuffer) => void): this; - // (undocumented) - on(event: 'end', listener: () => void): this; - // (undocumented) - on(event: 'error', listener: (err: Error) => void): this; - // (undocumented) - once(event: 'close', listener: () => void): this; - // (undocumented) - once(event: 'data', listener: (chunk: any) => void): this; - // (undocumented) - once(event: 'end', listener: () => void): this; - // (undocumented) - once(event: 'readable', listener: () => void): this; - // (undocumented) - once(event: 'error', listener: (err: Error) => void): this; - // (undocumented) - once(event: string | symbol, listener: (...args: any[]) => void): this; - // (undocumented) - pause(): this; - // Warning: (ae-forgotten-export) The symbol "WritableStream_2" needs to be exported by the entry point index.d.ts - // - // (undocumented) - pipe(destination: T, options?: { - end?: boolean; - }): T; - // (undocumented) - prependListener(event: 'close', listener: () => void): this; - // (undocumented) - prependListener(event: 'data', listener: (chunk: any) => void): this; - // (undocumented) - prependListener(event: 'end', listener: () => void): this; - // (undocumented) - prependListener(event: 'readable', listener: () => void): this; - // (undocumented) - prependListener(event: 'error', listener: (err: Error) => void): this; - // (undocumented) - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - // (undocumented) - prependOnceListener(event: 'close', listener: () => void): this; - // (undocumented) - prependOnceListener(event: 'data', listener: (chunk: any) => void): this; - // (undocumented) - prependOnceListener(event: 'end', listener: () => void): this; - // (undocumented) - prependOnceListener(event: 'readable', listener: () => void): this; - // (undocumented) - prependOnceListener(event: 'error', listener: (err: Error) => void): this; - // (undocumented) - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - // (undocumented) - push(chunk: any, encoding?: string): boolean; - // (undocumented) - rawListeners(event: string | symbol): Function[]; - // (undocumented) - read(size?: number): any; - // (undocumented) - _read(size: number): void; - // (undocumented) - readable: boolean; - // (undocumented) - readonly readableFlowing: boolean | null; - // (undocumented) - readonly readableHighWaterMark: number; - // (undocumented) - readonly readableLength: number; - // (undocumented) - ref(): any; - // (undocumented) - removeAllListeners(event?: string | symbol): this; - // (undocumented) - removeListener(event: string | symbol, listener: (...args: any[]) => void): this; - // (undocumented) - resume(): this; - // (undocumented) - setDefaultEncoding(encoding: string): this; - // (undocumented) - setEncoding(encoding: string): this; - // (undocumented) - setKeepAlive(enable?: boolean, initialDelay?: number): this; - // (undocumented) - setMaxListeners(n: number): this; - // (undocumented) - setNoDelay(noDelay?: boolean): this; - // (undocumented) - setTimeout(timeout: number, callback?: () => void): this; - // (undocumented) - uncork(): void; - // (undocumented) - unpipe(destination?: any): this; - // (undocumented) - unref(): any; - // (undocumented) - unshift(chunk: any): void; - // (undocumented) - wrap(oldStream: any): this; - // (undocumented) - writable: boolean; - // (undocumented) - readonly writableHighWaterMark: number; - // (undocumented) - readonly writableLength: number; - // Warning: (ae-forgotten-export) The symbol "ValidBuffer" needs to be exported by the entry point index.d.ts - // - // (undocumented) - write(buffer: ValidBuffer, cb?: (err?: Error) => void): boolean; - // (undocumented) - write(str: string, encoding?: string, cb?: Function): boolean; - // (undocumented) - write(buffer: ValidBuffer): boolean; - // (undocumented) - write(str: string, cb?: Function): boolean; - // (undocumented) - write(str: string, encoding?: string, fd?: string): boolean; - // (undocumented) - write(data: any, encoding?: string, callback?: Function): void; - // (undocumented) - write(chunk: any, cb?: (error: Error | null | undefined) => void): boolean; - // (undocumented) - write(chunk: any, encoding?: string, cb?: (error: Error | null | undefined) => void): boolean; - // (undocumented) - _write(chunk: any, encoding: string, callback: (error?: Error | null) => void): void; - // (undocumented) - _writev?(chunks: Array<{ - chunk: any; - encoding: string; - }>, callback: (error?: Error | null) => void): void; } // @public diff --git a/libraries/botframework-streaming/src/index.ts b/libraries/botframework-streaming/src/index.ts index 286936192a..bfd9ee1fc3 100644 --- a/libraries/botframework-streaming/src/index.ts +++ b/libraries/botframework-streaming/src/index.ts @@ -12,6 +12,7 @@ export { INodeBuffer, INodeIncomingMessage, INodeSocket, + INodeDuplex, IReceiveRequest, IReceiveResponse, ISocket, diff --git a/libraries/botframework-streaming/src/interfaces/INodeDuplex.ts b/libraries/botframework-streaming/src/interfaces/INodeDuplex.ts new file mode 100644 index 0000000000..bf9db21bdb --- /dev/null +++ b/libraries/botframework-streaming/src/interfaces/INodeDuplex.ts @@ -0,0 +1,21 @@ +/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types */ +/** + * @module botframework-streaming + */ +/** + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. + */ + +import { Duplex } from 'stream'; +import { INodeBuffer } from './INodeBuffer'; + +/** + * Represents a Duplex from the `stream` module in Node.js. + * + * This interface supports the framework and is not intended to be called directly for your code. + */ +export interface INodeDuplex extends Duplex { + on(event: string | symbol, listener: (...args: any[]) => void): this; + on(event: 'data', listener: (chunk: INodeBuffer) => void): this; +} diff --git a/libraries/botframework-streaming/src/interfaces/INodeSocket.ts b/libraries/botframework-streaming/src/interfaces/INodeSocket.ts index 1d117440c0..5453a66a44 100644 --- a/libraries/botframework-streaming/src/interfaces/INodeSocket.ts +++ b/libraries/botframework-streaming/src/interfaces/INodeSocket.ts @@ -7,152 +7,15 @@ * Licensed under the MIT License. */ -import { INodeBuffer, ValidBuffer } from './INodeBuffer'; -import { IEventEmitter } from './IEventEmitter'; +import { Socket } from 'net'; +import { INodeBuffer } from './INodeBuffer'; /** * Represents a Socket from the `net` module in Node.js. * * This interface supports the framework and is not intended to be called directly for your code. */ -export interface INodeSocket { - connecting: boolean; - destroyed: boolean; - writable: boolean; - readable: boolean; - readonly bytesRead: number; - readonly bufferSize: number; - readonly bytesWritten: number; - readonly localAddress: string; - readonly localPort: number; - readonly writableHighWaterMark: number; - readonly writableLength: number; - readonly readableHighWaterMark: number; - readonly readableLength: number; - readonly readableFlowing: boolean | null; - - address(): AddressInfo | string; - - connect(options: any, connectionListener?: () => void): any; - connect(port: number, host: string, connectionListener?: () => void): any; - connect(port: number, connectionListener?: () => void): any; - connect(path: string, connectionListener?: () => void): any; - - cork(): void; - uncork(): void; - - end(cb?: () => void): void; - end(chunk: any, cb?: () => void): void; - end(chunk: any, encoding?: string, cb?: () => void): void; - - _destroy(error: Error | null, callback: (error: Error | null) => void): void; - destroy(error?: Error): void; - - pause(): this; - resume(): this; - isPaused(): boolean; - unpipe(destination?: any): this; - unshift(chunk: any): void; - wrap(oldStream: any): this; - push(chunk: any, encoding?: string): boolean; - - pipe(destination: T, options?: { end?: boolean }): T; - - addListener(event: 'close', listener: () => void): this; - addListener(event: 'data', listener: (chunk: any) => void): this; - addListener(event: 'end', listener: () => void): this; - addListener(event: 'readable', listener: () => void): this; - addListener(event: 'error', listener: (err: Error) => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - - emit(event: 'close'): boolean; - emit(event: 'data', chunk: any): boolean; - emit(event: 'end'): boolean; - emit(event: 'readable'): boolean; - emit(event: 'error', err: Error): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - - eventNames(): Array; - _final(callback: (error?: Error | null) => void): void; - listeners(event: string | symbol): Function[]; - listenerCount(type: string | symbol): number; - - off(event: string | symbol, listener: (...args: any[]) => void): this; - +export interface INodeSocket extends Socket { on(event: string, listener: (...args: any[]) => void): this; - on(event: 'close', listener: (had_error: boolean) => void): this; - on(event: 'connect', listener: () => void): this; on(event: 'data', listener: (data: INodeBuffer) => void): this; - on(event: 'end', listener: () => void): this; - on(event: 'error', listener: (err: Error) => void): this; - - once(event: 'close', listener: () => void): this; - once(event: 'data', listener: (chunk: any) => void): this; - once(event: 'end', listener: () => void): this; - once(event: 'readable', listener: () => void): this; - once(event: 'error', listener: (err: Error) => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - - prependListener(event: 'close', listener: () => void): this; - prependListener(event: 'data', listener: (chunk: any) => void): this; - prependListener(event: 'end', listener: () => void): this; - prependListener(event: 'readable', listener: () => void): this; - prependListener(event: 'error', listener: (err: Error) => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - - prependOnceListener(event: 'close', listener: () => void): this; - prependOnceListener(event: 'data', listener: (chunk: any) => void): this; - prependOnceListener(event: 'end', listener: () => void): this; - prependOnceListener(event: 'readable', listener: () => void): this; - prependOnceListener(event: 'error', listener: (err: Error) => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - - rawListeners(event: string | symbol): Function[]; - - removeAllListeners(event?: string | symbol): this; - removeListener(event: string | symbol, listener: (...args: any[]) => void): this; - - [Symbol.asyncIterator](): AsyncIterableIterator; - - _read(size: number): void; - read(size?: number): any; - - setDefaultEncoding(encoding: string): this; - setEncoding(encoding: string): this; - setMaxListeners(n: number): this; - getMaxListeners(): number; - setTimeout(timeout: number, callback?: () => void): this; - setKeepAlive(enable?: boolean, initialDelay?: number): this; - setNoDelay(noDelay?: boolean): this; - - _write(chunk: any, encoding: string, callback: (error?: Error | null) => void): void; - _writev?(chunks: Array<{ chunk: any; encoding: string }>, callback: (error?: Error | null) => void): void; - - write(buffer: ValidBuffer, cb?: (err?: Error) => void): boolean; - write(str: string, encoding?: string, cb?: Function): boolean; - write(buffer: ValidBuffer): boolean; - write(str: string, cb?: Function): boolean; - write(str: string, encoding?: string, fd?: string): boolean; - write(data: any, encoding?: string, callback?: Function): void; - write(chunk: any, cb?: (error: Error | null | undefined) => void): boolean; - write(chunk: any, encoding?: string, cb?: (error: Error | null | undefined) => void): boolean; - - ref(): any; - unref(): any; -} - -interface AddressInfo { - address: string; - family: string; - port: number; -} - -interface WritableStream extends IEventEmitter { - writable: boolean; - write(buffer: Buffer | string, cb?: Function): boolean; - write(str: string, encoding?: string, cb?: Function): boolean; - end(cb?: Function): void; - end(buffer: Buffer, cb?: Function): void; - end(str: string, cb?: Function): void; - end(str: string, encoding?: string, cb?: Function): void; } diff --git a/libraries/botframework-streaming/src/interfaces/index.ts b/libraries/botframework-streaming/src/interfaces/index.ts index 6bef9ee517..eceb25327e 100644 --- a/libraries/botframework-streaming/src/interfaces/index.ts +++ b/libraries/botframework-streaming/src/interfaces/index.ts @@ -9,6 +9,7 @@ export * from './INodeBuffer'; export * from './INodeIncomingMessage'; export * from './INodeSocket'; +export * from './INodeDuplex'; export * from './IReceiveRequest'; export * from './IReceiveResponse'; export * from './ISocket'; diff --git a/libraries/botframework-streaming/src/namedPipe/namedPipeClient.ts b/libraries/botframework-streaming/src/namedPipe/namedPipeClient.ts index 71d997b75f..dc86172118 100644 --- a/libraries/botframework-streaming/src/namedPipe/namedPipeClient.ts +++ b/libraries/botframework-streaming/src/namedPipe/namedPipeClient.ts @@ -61,9 +61,8 @@ export class NamedPipeClient implements IStreamingTransportClient { const incomingPipeName: string = NamedPipeTransport.PipePath + this._baseName + NamedPipeTransport.ServerOutgoingPath; const incoming = connect(incomingPipeName); - // TODO: Fix INodeSocket type. Related issue https://github.com/microsoft/botbuilder-js/issues/4684. - this._sender.connect(new NamedPipeTransport(outgoing as any)); - this._receiver.connect(new NamedPipeTransport(incoming as any)); + this._sender.connect(new NamedPipeTransport(outgoing)); + this._receiver.connect(new NamedPipeTransport(incoming)); } /** diff --git a/libraries/botframework-streaming/src/webSocket/nodeWebSocket.ts b/libraries/botframework-streaming/src/webSocket/nodeWebSocket.ts index f6cdd740a3..1ce6ddc24b 100644 --- a/libraries/botframework-streaming/src/webSocket/nodeWebSocket.ts +++ b/libraries/botframework-streaming/src/webSocket/nodeWebSocket.ts @@ -10,6 +10,7 @@ import { IncomingMessage, request } from 'http'; import { URL } from 'url'; import crypto from 'crypto'; import WebSocket from 'ws'; +import { Socket } from 'net'; import { INodeIncomingMessage, INodeBuffer, INodeSocket, ISocket } from '../interfaces'; @@ -36,12 +37,16 @@ export class NodeWebSocket implements ISocket { * @param head A Buffer [INodeBuffer](xref:botframework-streaming.INodeBuffer) interface. * @returns A Promise that resolves after the WebSocket upgrade has been handled, otherwise rejects with a thrown error. */ - async create(req: INodeIncomingMessage, socket: INodeSocket, head: INodeBuffer): Promise { + async create(req: INodeIncomingMessage, socket: INodeSocket, head: INodeBuffer): Promise; + + /** + * @internal + */ + async create(req: IncomingMessage, socket: Socket, head: Buffer): Promise { this.wsServer = new WebSocket.Server({ noServer: true }); return new Promise((resolve, reject) => { try { - // TODO: Fix INodeSocket type. Related issue https://github.com/microsoft/botbuilder-js/issues/4684. - this.wsServer.handleUpgrade(req as IncomingMessage, socket as any, head as any, (websocket) => { + this.wsServer.handleUpgrade(req, socket, head, (websocket) => { this.wsSocket = websocket; resolve(); });