botframework-sdk icon indicating copy to clipboard operation
botframework-sdk copied to clipboard

[Feature Request] Direct Line service doesn't allow more than 4 concurrent web socket connections for the same conversation

Open hpksp opened this issue 8 years ago • 11 comments

Bot Info

  • SDK Platform: .NET
  • SDK Version: 3.14.1.1
  • Active Channels: Skype, Slack, Direct Line, Cortana, Skype for Business
  • Deployment Environment: Azure App Service

Issue Description

DirectLine service doesn't allow more than 4 concurrent web socket connections for the same conversation. My bot is running inside a web app connecting through direct line service. I'm storing conversation id and user id against the app user to resume the conversation. There are instances where users will open more than 4 browser tabs or log in from different devices at the same time/using same user id. Why is there a limitation? Is this something enforced recently? Is there a way to increase this value? I'm using S1 - Standard bot service pricing tier.

hpksp avatar Apr 02 '18 11:04 hpksp

@JasonSowers today it allowed me to open 5 concurrent connections :) As the admin/owner of DL secret, is there a way for me to close all the connections opened?

hpksp avatar Apr 03 '18 14:04 hpksp

I'm not aware of a limit to the number of concurrent connections to a conversation. Can you share the code you're using to connect multiple websockets to a conversation?

EricDahlvang avatar Apr 04 '18 00:04 EricDahlvang

@EricDahlvang I'm using DirectLineJS.

const dl = new DirectLine({ secret: /* SECRET */, conversationId: 'J78HEYxJiY6BJGj7JqTx9s' });

Here is request info got from Fiddler

Get Request

https://directline.botframework.com/v3/directline/conversations/J78HEYxJiY6BJGj7JqTx9s?watermark=

Request Headers

Host: directline.botframework.com Connection: keep-alive Accept: application/json Origin: our origin X-Requested-With: XMLHttpRequest Authorization: Bearer SECRET User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36 Referer: our referer Accept-Encoding: gzip, deflate, br Accept-Language: en-US,en;q=0.9

Response

{ "conversationId": "J78HEYxJiY6BJGj7JqTx9s", "token": "ioG0TEUAWIs.dAA.SgA3ADgASABFAFkAeABKAGkAWQA2AEIASgBHAGoANwBKAHEAVAB4ADkAcwA.3c5KTrfL0wE.SJ6zbA06jGY.hDcnU7z2b4Vyufhu1QRmHGiaoy15sbYA5dn1lNRW3us", "expires_in": 1800, "streamUrl": "wss://directline.botframework.com/v3/directline/conversations/J78HEYxJiY6BJGj7JqTx9s/stream?watermark=19&t=ioG0TEUAWIs.dAA.SgA3ADgASABFAFkAeABKAGkAWQA2AEIASgBHAGoANwBKAHEAVAB4ADkAcwA.3eArQbPL0wE.t2bmRDTtfqI.lJrzUJk6C-40BxN0bPPuLPFNsq2pAhZFwWYPw_yBDvM", "referenceGrammarId": "901cc264-c6ef-6a5f-a602-3adb79103fc1" }

Library tries to connect to streamUrl and it fails, and it keeps on trying, until I close a previously opened browser tab.

image

image

hpksp avatar Apr 04 '18 01:04 hpksp

@EricDahlvang Hi, any updates on this? :)

hpksp avatar Apr 12 '18 15:04 hpksp

@hpksp Apologies for the delayed response. I will look into this today and get back to you.

EricDahlvang avatar Apr 12 '18 18:04 EricDahlvang

There is in fact a limit on the number of web socket connections allowed. You'll need to write some code to gracefully handle the connection attempt failure. You could fallback to polling if the socket connection fails.

EricDahlvang avatar Apr 12 '18 19:04 EricDahlvang

@EricDahlvang Thanks for getting back quickly. Do you have any info on the number of max connections? Coz 4 seems to be quite limited. Also, it would be a nice feature to include an option in DirectLineJs to fallback to polling if reached max websocket conns so the library handles that automatically for the developer.

hpksp avatar Apr 13 '18 03:04 hpksp

How many websocket connections do you believe the Direct Line service should allow?

Please file a Feature Request for polling fallback in DirectLineJs here: https://github.com/Microsoft/BotFramework-DirectLineJS/issues/new

EricDahlvang avatar Apr 23 '18 17:04 EricDahlvang

Hi @EricDahlvang. Sorry for the late response. I'm afraid, I cannot exactly say how many connections it should allow. The issue we are currently facing is that the our own app user can open multiple instances of the application across multiple devices/multiple browser tabs, so the number is uncertain. I believe on browser based chat services like gmail allows considerable number of concurrent connections. And also if there's an option for bot admins to manage connections, that would be a nice feature. I will add that to the feature request list

hpksp avatar Apr 26 '18 08:04 hpksp

Labeled as Feature Request to support more concurrent web socket connections in the Direct Line Connector Service.

EricDahlvang avatar Apr 26 '18 22:04 EricDahlvang

Thank you for opening an issue against the Bot Framework SDK v3. As part of the Bot Framework v4 release, we’ve moved all v3 work to a new repo located at https://github.com/microsoft/botbuilder-v3. We will continue to support and offer maintenance updates to v3 via this new repo.

From now on, https://github.com/microsoft/botbuilder repo will be used as hub, with pointers to all the different SDK languages, tools and samples repos.

As part of this restructuring, we are closing all tickets in this repo.

For defects or feature requests, please create a new issue in the new Bot Framework v3 repo found here: https://github.com/microsoft/botbuilder-v3/issues

For Azure Bot Service Channel specific defects or feature requests (e.g. Facebook, Twilio, Teams, Slack, etc.), please create a new issue in the new Bot Framework Channel repo found here: https://github.com/microsoft/botframework-services/issues

For product behavior, how-to, or general understanding questions, please use Stackoverflow. https://stackoverflow.com/search?q=bot+framework

Thank you.

The Bot Framework Team

JasonSowers avatar Oct 01 '18 22:10 JasonSowers