Search code examples
node.jsbotframeworkbotschatbotspeech

inactivityTimer: Error: BotFrameworkAdapter.sendActivities(): Unable to send activity as Streaming connection is closed, Microsoft Bot Framework / DLS


I use Channel Direct Line Speech with my bot but when 15 minutes pass and the user does not interact with the bot in the webchat, the following error occurs:

unhandled error: Error: BotFrameworkAdapter.sendActivities(): Unable to send activity as Streaming connection is closed. inactivityTimer: Error: BotFrameworkAdapter.sendActivities(): Unable to send activity as Streaming connection is closed.

I need to restart the connection, please


Solution

  • Cognitive Services Speech tokens are only valid for 10 mins. Per their REST API docs, you can get a new token at any time, however they recommend using the same token for 9 mins to reduce network traffic and latency. For clarity, exchanging tokens shouldn't affect the performance of the speech service. At least, it hasn't for me, yet.