Direct Line App Service 擴充功能Direct Line App Service Extension

適用于: SDK v4APPLIES TO: SDK v4

Direct Line App Service 擴充功能可讓用戶端直接與 Bot 所在的主機連線。The Direct Line App Service Extension allows clients to connect directly with the host, where the bot is located. 它會在與您的 bot 相同的訂用帳戶、App Service 和 Azure 網路內執行,並提供網路隔離,而且在某些情況下會改善效能。It runs inside the same subscription, App Service, and Azure network as your bot and provides network isolation and, in some cases, improved performance. 用戶端應用程式會使用 WebSocket 通訊協定 與 bot 進行通訊。The client application uses WebSocket protocol to communicate with the bot. 下圖顯示整體架構:The following picture shows the overall architecture:

Direct line app service 擴充功能架構Direct line app service extension architecture

注意

如果您不需要網路隔離,而且想要透過 HTTPS 通訊協定使用標準通道,請參閱將 bot 連線到 Direct LineIf you do not require network isolation and want to use the standard channel over the HTTPS protocol, refer to Connect a bot to Direct Line.

Direct Line App Service 延伸模組會將一組新的串流擴充功能新增至 Bot Framework 的通訊協定,這會以允許雙向要求透過 持續性 WebSocket 傳送雙向要求的傳輸,取代 HTTP 以交換訊息。The Direct Line App Service Extension adds a new set of streaming extensions to the Bot Framework protocol, which replace HTTP for exchanging messages with a transport that allows bidirectional requests to be sent over a persistent WebSocket.

在串流擴充功能之前,Direct Line API 提供了一種方式讓用戶端將活動傳送至 Direct Line,並提供兩種方式讓用戶端從 Direct Line 擷取活動。Before streaming extensions, the Direct Line API offered one way for a client to send Activities to Direct Line and two ways for a client to retrieve Activities from Direct Line. 訊息會透過 HTTP POST 進行傳送,並由 HTTP GET (輪詢) 來接收,或藉由開啟 WebSocket 以接收 ActivitySets,來接收訊息。The messages were sent via an HTTP POST, and received by either an HTTP GET (polling) or by opening a WebSocket to receive ActivitySets. 串流擴充功能擴充了 WebSocket 的用途,且允許 所有訊息通訊 都在該 WebSocket 上傳送。Streaming extensions expand on the use of the WebSocket an allows all messaging communication to be sent on that WebSocket. 串流擴充功能也可在通道服務與 Bot 之間使用。Streaming extensions can also be used between channel services and the bot.

Direct Line App Service 擴充功能會預先安裝在世界各地每個資料中心的所有 Azure App 服務實例上。The Direct Line App Service Extension is pre-installed on all instances of Azure App Services in every data center around the world. 此擴充功能由 Microsoft 維護及管理,客戶不需要進行額外的部署工作。It is maintained and managed by Microsoft without additional deployment work for the customer. Azure App Service 依預設會加以停用,但您可以輕鬆地將其開啟,讓其能夠連線至您裝載的 Bot。It is disabled on Azure App Services by default, but it can be easily turned on so that it can connect to your hosted bot.

另請參閱See Also

名稱Name 描述Description
設定 .NET Bot 擴充功能Configure .NET bot for extension 更新 .NET Bot 以使用具名管道,並在裝載 Bot 的 Azure App Service 資源中啟用 Direct Line App Service 擴充功能。Update a .NET bot to work with named pipes, and enable the Direct Line App Service Extension in the Azure App Service resource where the bot is hosted.
設定 Node.js Bot 擴充功能Configure Node.js bot for extension 更新 Node.js Bot 以使用具名管道,並在裝載 Bot 的 Azure App Service 資源中啟用 Direct Line App Service 擴充功能。Update a Node.js bot to work with named pipes and enable the Direct Line App Service Extension in the Azure App Service resource where the bot is hosted.
建立具有擴充功能的 .NET 用戶端Create .NET client with Extension 使用 c # 建立 .NET 用戶端,以連接至 Direct Line App Service 擴充功能。Create a .NET client in C# which connects to the Direct Line App Service Extension.
使用延伸模組與網路聊天Use extension with Web Chat 使用網路聊天搭配 Direct Line App Service 擴充功能。Use Web Chat with the Direct Line App Service Extension.
在 VNET 中使用擴充功能Use extension within VNET 使用 Direct Line App Service 擴充功能搭配 Azure 虛擬網路 (VNET) 。Use the Direct Line App Service Extension with an Azure Virtual Network (VNET).

其他資源Additional resources