I'm using the Microsft BotFramework.
Process:
the clients ask my bot to generate a specific code
1. The bot answer to the client that he is generating the code.
2. After about 10 seconds, the bot send the code to the client, without any other request.
Problem:
I'm using the
ReplyToActivityAsync(...)
method to send both answers, before the return statement.
In that case there is a post timeout error between the 2 answers.
That's my code:
if (activity.Type == ActivityTypes.Message)
{
ConnectorClient connector = new ConnectorClient(new Uri(activity.ServiceUrl));
// return our reply to the user
string welcomeMessage = "[...] Reply 1 [...]"
await connector.Conversations.ReplyToActivityAsync(activity.CreateReply(welcomeMessage));
// MyApi.GetCode() takes about 10 secs
await connector.Conversations.ReplyToActivityAsync(activity.CreateReply(MyAPI.GetCode()));
}
How to start a reply without waiting for a user request ?
Thanks !
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…