-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
First welcome message is delayed for 5 seconds #3431
Comments
The first activity from the bot has a The following screenshot is the first activity after Web Socket is connected. To repro:
|
(Ping SDK team to better understand why the bot is replying to a non-existing activity ID.) |
Related to #3236 |
Talked to @stevengum of SDK team and looks like it is technically impossible to have the We will use a shorter timeout for the first activity. |
@compulim looks like this one is still causing errors in IcM 203406335 |
When updating the playground, I noticed that there is around a 5 second delay for when the typing indicator is shown when |
Investigate 1It only affect typing activities. It does not affect message activities. We are testing against https://microsoft.github.io/BotFramework-WebChat/05.custom-components/b.send-typing-indicator/. When user type, we receive the echoback activity of typing without When the bot echo, the bot replied to activity 1. Let's call this activity 2. The delay is caused by activity 2 not showing up sooner. We should study why the logic isn't followed:
|
We have this problem with Version 4.10.1: When showing the chat history to the user and combining this with the reaction buttons, the reaction - buttons and the welcome - messages are delayed by ~5 seconds when reloading the page. Could be a hint to find the solution for this problem. |
InvestigationsThe problem is, we didn't put "activity of type typing" inside the transcript. Thus, the "typing" activity from the bot will never able to find the activity it is replying to. But for "message" activities, I tested it with current build and it actually looks good. I have a prototype working, by "don't skip the typing activity, always put it in transcript". Before finalizing the solution, I will investigate @MatthiasGwiozda issue a bit furthermore. Thanks @MatthiasGwiozda. |
@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 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. |
The bug is not fixed for me with the following components. The delay with 5 seconds still persists: This is the welcome - Bot : 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)) |
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 Interestingly the problem that we had with the reaction - buttons is solved now after the welcome - message is sent without a delay. |
reopening for investigation. @compulim could you take a look? |
I have the same problem, is there any fix for this? Update* |
I believe I am having this problem too. |
Update on the IcM ticket 203406335: that ticket is resolved by the SDK. So it's probably unrelated to this issue. So we still need to investigate/fix in Web Chat. |
@eyadon "Connecting..." is different, this indicator is based on whether the Web Socket is connected or not. It is not based on any activities received. If it take 5 seconds for "Connecting..." to go away, the Web Socket take 5 seconds to connect. If the delay is caused by waiting for an activity, you should see a warning in the console. If you see any, can you copy it here? |
@arman-g this ID is from Azure Bot Services. Web Chat has no control over the value or its content. Thus, Web Chat won't parse it or do any comparisons over them. We just treat it as a string and assume it's non-sequential like a random GUID. |
@MatthiasGwiozda I talked to the SDK team and they said this is a by-design issue: the first activity ID is in "malformed" format. And they won't take it out. So in Web Chat, if the transcript is empty, we will not delay any activities with Reply-To-ID set. In other words, we will not delay the first activity coming in, regardless it has Reply-To-ID or not. And right now, activities sent by the user do not set Reply-To-ID, so we won't delay showing up these activities too. Looks like your problem is fixed (after your edit on Nov 22). If you continue to see the problem, please copy the console warning regarding the delay to us. Thanks! |
Found the issue. This is because of a race condition:
The timeout occurs if the user's message was send before the bot message was received. Originally, we allow the bot's activity to show up even they point to a bogus activity, if that message was the very first activity in the transcript. Because the user's activity was already in the transcript, the relaxation was not granted. Thus, the bot's activity is subject to "reply to ID" and a timeout. |
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
Expected behavior
Instead, the "Hello and welcome!" arrive 5 seconds after the Web Socket packet has arrived.
Additional context
[Bug]
The text was updated successfully, but these errors were encountered: