Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Streaming] Low-level hook for initializing WebSocket connection #1386

Closed
stevengum opened this issue Nov 5, 2019 · 1 comment
Closed

[Streaming] Low-level hook for initializing WebSocket connection #1386

stevengum opened this issue Nov 5, 2019 · 1 comment
Assignees
Labels
P1 Painful if we don't fix, won't block releasing R7 Release 7 - December 10th, 2019
Milestone

Comments

@stevengum
Copy link
Member

Is your feature request related to a problem? Please describe.
The current way to set up a WebSocket connection via the BotFrameworkAdapter is to use processActivity(req, res, logic: async (context) => Promise<any>) which may call useWebSocket(req, res, logic: async (context) => Promise<any>).

The problem with the current implementation is that it ties useWebSocket() to the restify framework, which helpfully exposes the socket and head via ServerUpgradeResponse.claimUpgrade() method.

Other web service frameworks do not offer the same helper code.

The one shared feature most Node.js Web libraries offer is a way to listen for the "upgrade" event emitted from the http.Server.


Describe the solution you'd like
A low level entry-point for useWebSockets(). The updated signature may look like the following:

public async useWebSockets(req: http.IncomingMessage, socket: net.Socket, head: Buffer, logic: (context: TurnContext) => Promise<void>): Promise<void>

The current preview high-level entry-point BotFrameworkAdapter.processActivity() would not be used for WebSockets, only for regular HTTP requests.


Additional notes
Upgrade requests for WebSockets from Direct Line Speech only come in with GET requests. In the code, we would begin the authentication process if it's a valid Upgrade request using the GET method.

Requests with non-GET methods would simply pass through BotFrameworkAdapter.useWebSockets()


@christopheranderson, @carlosscastro, @DDEfromOR

@stevengum
Copy link
Member Author

Closing via #1433.

@munozemilio munozemilio added this to the R7 milestone Jul 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 Painful if we don't fix, won't block releasing R7 Release 7 - December 10th, 2019
Projects
None yet
Development

No branches or pull requests

2 participants