Using the latest master webchat.js, I have this strange behaviour when I talk to the bot that user message is first displayed above the last bot message, then after a new bot reply it is positioned correctly => inbetween the last bot reply and the previous bot reply. I can reproduce this also on the examples.
See video
https://youtu.be/0tkQ22iFZpQ
Hi @jvanderbiest, one of our users recently discovered that this was due to a computer's time being behind official time. Please see this issue: https://github.com/Microsoft/BotFramework-WebChat/issues/1890
hi @corinagum,
My time settings are correct and I still have this issue. My Date & Time settings are set to automatically on Windows 10. I still think it's an issue as I was able to reproduce it on multiple boxes.
@jvanderbiest can you check timezone in your browser machine?
I checked the code here, this is where we find the correct place to insert the activity into.
nextActivity is the activity that we will be adding into the transcript. In your video, this is the message which the user is sending (while it is sending, not being sent)nextActivity.timestamp is generated from local timestamp, which is the code here and herenextTimestamp, we will use this timestamp to find the correct place to insert the activity intoactivity.timestamp is larger than the one in nextTimestamp (the one we are holding onto), so we should insert before thatIt is being corrected momentarily because after the message is successfully sent, our server will put the server's clock in timestamp field, overriding the value generated by postActivitySaga.js:54. To me, it seems like there is a clock skew between your client's box and the server. We use UTC for comparison so I believe it should be good.
Could you help us to debug into a few things?
console.log(nextTimestamp + ' ' + new Date()); therenextTimestamp is a value very close to new Date()? And can you verify the timestamp is correct? Note that it is in UTC+00 timezone, not your local timezone.console.log(nextActivities); and console.log(indexToInsert);indexToInsert is correctly pointing to the place the activity should be inserted chronologically?activities all have correct timestamp?Instead of simply appending to the activities array, we need to find the correct place to insert the activity because activities can be come from server out-of-order. One way we could perma-fix that is to sync clock skew from time to time.
Closing due to inactivity.
I am experiencing the same problem as @Slayouth when using WebChat (https://cdn.botframework.com/botframework-webchat/latest/webchat.js) and botbuilder 4.4.0. Works as expected in Bot Emulator.
I deployed to Azure Web App which has UTC timezone. I configured my local dev machine to run UTC as well.
Unfortunately, this is a show stopper.
@MStumpp could you debug with @compulim's instructions above and get back to us?
Results of debug test:
1.) Bot shows welcome message:
Line 38: 1559614371923 Tue Jun 04 2019 04:12:08 GMT+0200 (Mitteleurop盲ische Sommerzeit)
=> nextTimestamp + ' ' + new Date() => 1559614371923 Tue Jun 04 2019 04:12:08 GMT+0200 shows a little gap of approx. 45s. If user adds new message in less than 45s after bot shows welcome message, user's message is placed on top (which is wrong). however, when user adds new message after 45s after bot shows welcome message, all is fine.
Any updates on this?
Assigning to @compulim for investigation
Yes, very close is subjective. 馃槀
Looks like the local machine has a clock skew of about 43 seconds, when compare to our servers.
So, in order to fix this without asking the user to update their clock, we need to add a "de-clock-skew" logic to reducers/activities.js.
Currently we don't have any REST API to measure the clock skew on the client box, one will need to use a public API to estimate the clock skew and compensate for it while inserting the activity.
p.s. we can't use fetch to estimate the clock skew because "Date" is a forbidden header name and cannot be retrieved programmatically.
After talking to the channel team, the other way, is to use the first activity as a base for the clock for both outgoing and incoming activity.
The sorting problem we witness here is because the outgoing activity cannot be timestamped using an accurate clock. The client clock has skewed too much (> 2s) compare to the server, thus, the outgoing activity we timestamped is in wrong position.
We should try this approach and see how it works:
t = 0time field using t and set it to relativeTime property (not to confuse with the original time field)t. If t is not available, we will set it to 0Why not use some incrementing counter instead to ensure correct order?
On using the previous version's (v3) latest/botchat,js and latest/botchat.css, this issue seems to be absent consistently. Is there any way we can make use of previous botchat.js while availing the current features of webchat.js (v4) (e.g. card components) ? The link for both are pasted here, have a look.
https://cdn.botframework.com/botframework-webchat/latest/botchat.js
https://cdn.botframework.com/botframework-webchat/latest/botchat.css
Can't use counter because we plan to support update activity and resume conversation (loading chat history). These activities will come out-of-order and need to be sorted by time.
The steps outlined in my comment above should fix most of the issues. Just need time to implement them.
Do we have a time line for a fix? Thx
No current timeline - this issue is currently filed in our Backlog.
Would love to see if this fit in 4.6, looks like it hit quite some users.
Most helpful comment
Would love to see if this fit in 4.6, looks like it hit quite some users.