Skip to content
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

Emulator displays all of a turn's messages at the same time #2262

Open
v-kydela opened this issue Apr 23, 2021 · 1 comment
Open

Emulator displays all of a turn's messages at the same time #2262

v-kydela opened this issue Apr 23, 2021 · 1 comment
Labels
Bug Your classic code defect ExemptFromDailyDRIReport

Comments

@v-kydela
Copy link

v-kydela commented Apr 23, 2021

Version

4.12.0

Describe the bug

When Emulator sends a request to the bot, it waits for an HTTP response before it updates the UI with all the messages the bot sent to the Emulator

To Reproduce

  1. Run a bot that sends multiple messages in one turn with a delay between them
  2. Connect to the bot in Emulator
  3. Observe that the messages are all displayed at the same time

Here is some Python code that can reproduce the problem. Note that the problem is not Python-specific, and can be reproduced with any language.

async def on_message_activity(self, turn_context: TurnContext):
    start = time.time()

    elapsed = time.time() - start
    print(f"Message received after {elapsed:.1f} seconds")
    await turn_context.send_activity(f"Message received after {elapsed:.1f} seconds")

    await asyncio.sleep(2)

    elapsed = time.time() - start
    print(f"Finished after {elapsed:.1f} seconds!")
    await turn_context.send_activity(f"Finished after {elapsed:.1f} seconds!")

Expected behavior

Emulator should display messages immediately as it receives them, the same as any channel.

Screenshots

This is the problem in Emulator:

Emulator

Here you can see that the print statements are displayed at the right time while the send_activity statements aren't:

Console

This is the correct behavior in Web Chat (which can be seen in any other channel as well):

WebChat

Additional context

Related Stack Overflow thread: https://stackoverflow.com/questions/67172737/botbuilder-display-message-while-waiting-for-blocking-function

[bug]

@EricDahlvang
Copy link
Member

Related #2206

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Your classic code defect ExemptFromDailyDRIReport
Projects
None yet
Development

No branches or pull requests

3 participants