botbuilder-python icon indicating copy to clipboard operation
botbuilder-python copied to clipboard

port: Streaming Library Refactor (#5908)

Open github-actions[bot] opened this issue 4 years ago • 0 comments

The changes in Streaming Library Refactor (#5908) may need to be ported to maintain parity with microsoft/botbuilder-dotnet.

Fixes #5630

Description

This PR refactors the Bot Framework streaming protocol implementation in order to address certain issues (race conditions, memory leaks, reliability, testability, etc.) found with the legacy implementation. The details of the design and motivation behind this change can be found here.

Bot Framework Streaming Protocol

image The Bot Framework Streaming Protocol stays the same even after this change, only the underlying implementation is being refactored. CloudAdapter uses the new implementation as default, and BotFrameworkHttpAdapter uses the legacy implementation as default. Both these defaults can be overridden if needed.

Architecture

image

Class Diagrams

image image

Specific Changes

  • The only public APIs exposed are StreamingConnection (used by the bot adapter), and IStreamingTransportClient (used by channel SDK). The concrete implementations of these interfaces are WebSocketStreamingConnection and WebSocketClient respectively.
  • Legacy implementations in StreamingRequestHandler are refactored into a new obsolete public class LegacyStreamingConnection which extends StreamingConnection.
  • CloudAdapter is updated to use new streaming library, and support for responding to proactive/skills messages over web socket connection.
  • Internal classes in the Session layer and Transport layer that encapsulate the 2-way transfer of request/response streams.

Related docs

  • System.IO.Pipelines: The new implementation uses I/O Pipelines to abstract a lot of socket boilerplate code. Kestrel and signalR use this with great success.
  • High performance logging: The streaming stack uses the high performance logging pattern from asp.net core, given the potentially higher volume of operations.

Please review and, if necessary, port the changes.

github-actions[bot] avatar Oct 15 '21 04:10 github-actions[bot]