microsoft / BotFramework-DirectLine-DotNet

C# client library for Microsoft Bot Framework's Direct Line protocol
MIT License
27 stars 36 forks source link

.Net Client-side NuGet : support reconnection when the secret is server-side #2

Open gcollic opened 5 years ago

gcollic commented 5 years ago

Issue

In the Microsoft BotBuilder family, the .Net NuGet package Microsoft.Bot.Connector.DirectLine is not Open Source and does not have a GitHub repo, so I open this issue here.

In the bot service documentation, it says that if an app has an expired token (too late to be renewed) in the client side, it should ask the server-side of the application to create a new token for the current conversation, based on the secret (that the server-side has but not the client-side) : Reconnect to conversation.

The typescript DirectLine SDK has the documented "reconnect" function which updates the new token and new websocket stream url.

The .Net C# NuGet client SDK does not have a reconnect function which accepts the new token and websocket stream url like the TypeScript SDK does. It only proposes to use the current expired token to create a new one itself. It makes it more difficult to implement bot client in C#.

Proposed change

Adding to the .Net client SDK the feature supported by the TypeScript SDK.

Ideally, open sourcing the client NuGet package too.

Component Impact

The .Net NuGet package Microsoft.Bot.Connector.DirectLine.

Customer Impact

Not able to follow the documentation for expired tokens when creating .Net bot client which uses a token and does not embed the secret itself.

Tracking Status

Dotnet SDK

[dcr]

sgellock commented 5 years ago

Mistakenly assigned this to the wrong repo. putting in the v3 repo where it belongs

EricDahlvang commented 5 years ago

Thanks for filing this issue. You're right, it is more complex to work with the DirectLineClient compared to the DirectLineJS library. However, you can check the DirectLineClient's token expiration time, and refresh it client side. You then need to manually re-connect to the websocket using the refreshed streamUrl. Based on your comments, it sounds like you are already doing this, but would appreciate having the DirectLineClient perform this internally (just as DirectLineJS currently does).

For now, I'll label this issue as an Enhancement request. There has been talk of open sourcing the DirectLineClient. Hopefully that will happen soon.

EricDahlvang commented 5 years ago

DirectLineClient will live here soon: https://github.com/microsoft/botframework-directline-dotnet

EricDahlvang commented 5 years ago

Thanks @sgellock !