Refresh frequency for DirectLineClient
Hi Team,
I notice that in the web chat bot client the refresh frequency by which we are polling the bot is around 500mS. Using the DirectLineClient the same referesh occurs at around 5 seconds. Is there somewhere we can control the frequency at which the DirectLineClient polls the bot for responses? DirectLineClient is a part of the using Microsoft.Bot.Connector.DirectLine Namespace.
Thanks
Hi @Sams4u, there's no polling loop built in to the DirectLineClient. You control the interval in your code.
May i know where can i set that. Below is the lines of code i am using. Please suggest
Message message = new Message(conversationId: conversationID, text: messageLocal);
message.FromProperty = "xyz";
convs.PostMessage(conversationID, message);
response = convs.GetMessages(conversationID, waterMark);
You must put your GetMessages call in a loop. Take a look at the "ReadBotMessagesAsync" method here: https://github.com/Microsoft/BotBuilder-Samples/blob/master/CSharp/core-DirectLine/DirectLineClient/Program.cs
I understand the Asynchronous calls with loop you referring to. But here my problem is since its a webform based client application however frequently i make the calls, response cant be updated to the chat UI unless initiated by user event. So once user clicks the send button, call comes to the server and it process the result and send the response back. But if any response comes few seconds after it wont be send to the page asynchronously. So real time communication is not happening. Any suggestion?
Hi @Sams4u, you would need to change your application so the browser can receive updates from the server. A simple webform application is typically not capable of asynchronous chat, no matter what protocol it is using.