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.

Typing indicator middleware might show after sending message(s)

See original GitHub issue

Version

4.6.2

Describe the bug

Typing indicator is showing after a message has been sent by the bot and typing indicator will timeout depending on the front-end channel that is used. This only happens if you do more work in the Turn then just sending out a single message like in the examples. In our current implementations we also save data to the database, execute some external processes and they all need to finish before the Cancellation is actually called on the ShowTypingMiddleware.

To Reproduce

Repro repo: https://github.com/jvanderbiest/echo-bot-typing-indicator

Steps to reproduce the behavior:

  1. Switch between ShowTypingMiddleware and CustomShowTypingMiddleware https://github.com/jvanderbiest/echo-bot-typing-indicator/blob/master/AdapterWithErrorHandler.cs#L18

The EchoBot simulates some extra work after sending the initial message

Code snippet:

protected override async Task OnMessageActivityAsync(ITurnContext<IMessageActivity> turnContext, CancellationToken cancellationToken)
        {
            var activity = await CreateActivityWithTextAndSpeak($"Echo: {turnContext.Activity.Text}");
            await RunSomething();
            await turnContext.SendActivityAsync(activity, cancellationToken);
            await RunSomething();
        }

        private async Task RunSomething()
        {
            await Task.Delay(5000);
        }

As a temporary fix, I check if the bot has already responded: https://github.com/jvanderbiest/echo-bot-typing-indicator/blob/master/CustomShowTypingMiddleware.cs#L90

Expected behavior

Sending a bot message should stop the typing indicator and it should not send out any typing indicator activities

Screenshots

How it currently works typing-fail

How it should work typing-ok

Additional info

Any workaround or suggestion is appreciated

[bug]

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:13 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
dmvtechcommented, Dec 9, 2019

I am able to reproduce this now (not sure what I was doing before 😐). I can repro on both 4.6.2 and 4.6.3.

1reaction
jvanderbiestcommented, Dec 4, 2019

I could even reproduce the issue with v4.7.0-preview-191203-1 from myget. So it’s still there…

@dmvtech my repo reproduced the issue, just use the normal ShowTypingMiddleware by commenting out the CustomShowTypingMiddleware as I described in the repro steps. It happens at least on these channels: emulator, webchat, facebook. Did not try other channels but I guess it has the same issue as it sends out the TypingActivity afterwards.

https://github.com/jvanderbiest/echo-bot-typing-indicator/blob/master/AdapterWithErrorHandler.cs#L18

Read more comments on GitHub >

github_iconTop Results From Across the Web

Typing indicator shows even afterr message is sent Bot ...
I've been trying to implement the typing indicator (befor bot sends a message) for a bot created through Bot Framework Composer. The guidelines ......
Read more >
ShowTypingMiddleware class
Middleware that will send a typing indicator automatically for each message.
Read more >
ShowTypingMiddleware Class (Microsoft.Bot.Builder)
When added, this middleware will send typing activities back to the user when a Message activity is received to let them know that...
Read more >
ShowTypingMiddleware keeps showing indicator even after ...
ShowTypingMiddleware class pretty helpful. The Main issue I am facing is that, the bot keeps showing the typing indicator even after the message...
Read more >
Typing indicator | PubNub Docs
Typing indicators enable you to indicate if users are typing messages in a channel. This feature is easy to implement and can significantly ......
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