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.

First welcome message is delayed for 5 seconds

See original GitHub issue

Version

4.10.0

Describe the bug

The first welcome message coming in is being delayed for 5 seconds. Probably due to recent accessibility fix that would delay message up to 5 seconds if their “reply-to-id” activity was not arrived yet.

Steps to reproduce

  1. Go to MockBot2
  2. You should see “Hello and welcome!”

Expected behavior

Instead, the “Hello and welcome!” arrive 5 seconds after the Web Socket packet has arrived.

Additional context

[Bug]

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:20 (15 by maintainers)

github_iconTop GitHub Comments

3reactions
MatthiasGwiozdacommented, Nov 18, 2020

The bug is not fixed for me with the following components. The delay with 5 seconds still persists:

This is the welcome - Bot :

https://github.com/microsoft/BotBuilder-Samples/tree/main/samples/typescript_nodejs/03.welcome-users/src

and this is the frontend with the newest webchat - version and the webchat/join - event:


<!DOCTYPE html>
<html>

<head>
    <script crossorigin="anonymous" integrity="sha384-VaCCB1kZvCsUv3mrVO7ND25gqCPmUGP9NMOJEveBa1vsLyQw3i4pdOq03UZtMLE8"
        src="https://cdn.botframework.com/botframework-webchat/4.11.0/webchat.js"></script>

    <style>
        html,
        body {
            height: 100%;
        }

        body {
            margin: 0;
        }

        #webchat {
            height: 100%;
            width: 100%;
        }
    </style>
</head>

<body>
    <div id="webchat" role="main"></div>
    <script>
        const store = window.WebChat.createStore({}, ({ dispatch }) => next => action => {
            if (action.type === 'DIRECT_LINE/CONNECT_FULFILLED') {
                dispatch({
                    type: 'WEB_CHAT/SEND_EVENT',
                    payload: {
                        name: 'webchat/join',
                        value: { language: window.navigator.language }
                    }
                });
            }

            return next(action);
        });

        window.WebChat.renderWebChat(
            {
                directLine: window.WebChat.createDirectLine(
                    {
                        // token: 'XXXXX'
                    }
                ),
                userID: 'YOUR_USER_ID',
                username: 'Web Chat User',
                locale: 'en-US',
                store
            },
            document.getElementById('webchat')
        );
    </script>
</body>

</html>

With this 2 components the message is shown after 5 seconds. But when I use the onEvent - handler in the welcome-users-bot, the message is shown faster and the bug seems to be fixed with this backend - code:

constructor() {
        super();

        this.onEvent(async (context, next) => {
            if (context.activity.name === 'webchat/join') {
                await context.sendActivity(
                    `Got \`webchat/join\` event, your language is \`${(context.activity.value || {}).language}\``
                );
            }
            await next();
        })

// (...)
}

My Suggestion is to change the botbuilder-Samples to use the “onEvent - function” because they are currently not working correctly (even when I use the newest Versions of webchat and botbuilder (4.11.0))

1reaction
MatthiasGwiozdacommented, Nov 22, 2020

@MatthiasGwiozda I think you might be hitting a different issue. We are only seeing the issue related to typing activity.

When loading chat history, for activities that have replyToId specified, are those referenced activities appears in the chat history too?

In code, that means,

activities.find(x => x.replyToId && activities.every(y => y.id !== x.replyToId))

If you see anything show up, they are “activities that are replying to another activity that does not exist, or did not arrive yet”. Activities listed will be delayed as we are waiting for their associated activity to arrive thru the network or until timeout.

In the PR #3554, I am adding a new console warning to help diagnosing activities that are delayed due to their counterpart did not show up on time.

There are replyToId’s that doesn’t seem to exist. This is the case for the first message where the replyToId seems to be in a different format than the other activity - id’d:

malformed first message replyToId”: AZdTGlUdbui “not malformed replyToId”: F4Mi2hwvvWVJAvq3YuZ19a-o|0000000

Interestingly the problem that we had with the reaction - buttons is solved now after the welcome - message is sent without a delay. This means for me that the reaction -button - problem is in fact related with the delayed welcome - message.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Windows "randomly" spending WAY too long on Welcome ...
The usual time spent on this screen is some 6 seconds (2 full cycles of the twirling dots animation). Now, the thing is,...
Read more >
delay in receiving text messages - Apple Community
It is a noticeable delay swell from my MacBook and my iPhone (my MacBook receives the messages a few seconds first). Hope this...
Read more >
How to Fix Delay or Lag When Typing in Windows
A slow computer, faulty USB ports, outdated keyboard drivers, and misconfigured keyboard settings are a few of the reasons for keyboard lag.
Read more >
Welcome/Greeting message delay in webchat MS botframework
The very first activities network request (before showing the welcome/greeting message) is usually 2-6s long(mostly it's either 2.5s or 5-6s).
Read more >
Troubleshooting Delayed Syslog Messages - LogRhythm
But, of course, before the end of the week, we heard the first report ... on the server confirmed they were arriving a...
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