question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DirectLine token is getting expired and I'm not able to generate a new one(using websocket)

See original GitHub issue

From @prajwalsimha94 on October 21, 2018 15:16

I’m using BotFramework DirectLine websocket to post and receive messages with the bot. While it works fine, the directline token expires in about half hour, forcing my app to generate a new token. I’m using the following code to subscribe to “Token Expired” event:

directline.connectionStatus$
.subscribe(function(connectionStatus)) {
  switch(connectionStatus){
    case BotChat.ConnectionStatus.Uninitialized:
      //some code
      break;
    case BotChat.ConnectionStatus.Connecting:
      //some code
      break;
    case BotChat.ConnectionStatus.Online:
      //some code
      break;
   case BotChat.ConnectionStatus.ExpiredToken:
      // generate a new token and reconnect to the conversation
      break;
  }
}

The problem is, case “BotChat.ConnectionStatus.ExpiredToken” is not getting triggered even if the token is expired. But while using the POLLING approach the expired token event gets triggered.

Browser console throws error 403 forbidden when I try to post an activity after the token is expired. Any help would be appreciated. Thanks!

Copied from original issue: Microsoft/BotFramework-WebChat#1223

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
bhushanvadgavecommented, Nov 5, 2018

@vincec-msft We have enabled websocket in our webchat by doing a minor code changes in DirectlineJS dependency. Though “using watermark to fetch history messages” is working fine, we are facing THIS issue with ExpiredToken event. ExpiredToken event is not triggered when token actually gets expired…

Can you please guide us on this?

0reactions
xtianus79commented, Sep 20, 2021

@compulim this is still an issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

DirectLine token is getting expired and I'm not able to ...
I'm using BotFramework DirectLine websocket to post and receive messages with the bot. While it works fine, the directline token expires in ...
Read more >
Direct Line Authentication in Azure Bot Service - Microsoft Learn
If the request is successful, the response contains a new token that is valid for the same conversation as the previous token and...
Read more >
asksuite-botframework-directlinejs - npm
Start using asksuite-botframework-directlinejs in your project by running `npm i asksuite-botframework-directlinejs`. There are no other ...
Read more >
botframework-directline-angular6 - npm package - Snyk
client library for the Microsoft Bot Framework Direct Line 3.0 protocol. THIS IS A BETA TESTING PROJECT TO MAKE THIS PROJECT COMPATIBLE WITH...
Read more >
The WebSocket API (WebSockets) - Web APIs - MDN Web Docs
desktop desktop Chrome Edge WebSocket Full support. Chrome4. Toggle history Full support. Edge12. Toggl... WebSocket() constructor Full support. Chrome4. Toggle history Full support. Edge12. Toggl...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found