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

[POC] Local directline controller #3973

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

boydc2014
Copy link
Contributor

@boydc2014 boydc2014 commented May 7, 2024

Context

This is a POC with a local directline controller that allows a directline client connects to bot directly without using anything in the middle, no directline app service extension (DL-ASE) required.

This serves as an alternative to the current DL-ASE solution in network isolated scenarios, where customers are looking for highly controlled network environment, for example, both clients and bots and all the traffics must be within same VNET, which can't be done with public directline service.

Features

  • Compatible with DL-ASE clients
  • Compatible with CloudAdapter and all the middlewares
  • Simple, robust and transparent architecture
  • Easy to use with few lines of changes
  • No external dependency to Azure Bot Service if not for oauth
  • Full control over token auth
  • Free
  • No Emulator required to test bots

ToDo

  • Attachment support
  • JS support
  • Release plan

Design

Motivation

This is to address some of the challenges and issues we are facing for the current DL-ASE solution, including but not limited to the followings

  • Known connectivity issues between the DL-ASE extension and the bot application over local named pipes which can't be auto-detected and recovered in a robust way due to certain technical limitations.
  • Visibility issue into the extension's behavior and the interaction between extension and bot, mostly because of the extension runs in an isolated sandbox.
  • The long release process of an extension doesn't provide the agility customer need and Microsoft needs to support customer.
  • Complicated and may be also confusing network setup in DL-ASE.

Architecture

A comparison of DL-ASE and this local directline controller is
image

Core differences

Comparing to DL-ASE, the solution of local directline controller has a few advantages

  • Simplified architecture.

Local directline controller

With a local directline controller that builds into the bot application, we will get a few benefits

  • Reduce one layer of connection, there will be only one websocket from client bot.

Implementation changes

TBD

How to use

There are 3 changes in this PR that you need to pick into your bot

  1. Self check
  • Please make sure you use CloudAdapter
  • Please make sure you do have an AdapterWithErrorHandler class
  1. Adapter change

See the updates to samples/csharp_dotnetcore/02.echo-bot/AdapterWithErrorHandler.cs

This is to add one method to expose an internal protected method out. This is likely not going to need in next iteration of this POC with latest SDK.

  1. Controller change

Please copy this new directline controller into your controller folder.

(Optional) Please update the namespace to align with the namespace you use for your existing controllers.

  1. (Optional) startup.cs

The startup.cs change is to support CORS, if you want to test this bot in web pages.

This is not needed for calling this API using clients directly.

  1. Update your client
    Please update your client to point to /v3/directline. Removing the /.bot/ part in the url.

You can also update the routing part in directline controller to whatever path your like.

  1. (Optional) Clean up your DL-ASE setup

  2. (Applies to dotnet clients) Make sure ChannelId is included inside the Activity object
    When you are sending out an activity from the dotnet client, make sure the Activity object has the following property set ChannelId = "webchat".

@boydc2014 boydc2014 requested a review from a team as a code owner May 7, 2024 09:34
@boydc2014 boydc2014 changed the title [POC][Do Not Merge] Local directline controller [POC] Local directline controller May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant