Open pachamuthu5142 opened 2 months ago
OK so please keep in mind when reading the following that I haven't looked at this code in about seven years 😅
First of all, you don't need to, and probably shouldn't, subscribe twice to the same activity stream. I would instead do something like:
directLine.activity$
.filter(({type}) => type === "message")
.subscribe(message => {
if (message.from.id === "myUserId") {
...
} else {
...
}
}
As for all those activity requests, by default DirectLine receives activities via WebSocket, so you actually shouldn't see any. Is it possible you set your options do not use WebSocket?
thanks you reply @billba when set webSocket: true those activity requests are stopped but the previous conversations not resuming
I'm not quite sure what that means. Can you spell out your scenario in more detail? Also, did you move to a single subscription as I recommended?
I have created a WebChat UI in React using the botframework-directlinejs package. While subscribing to messages, the application is continuously sending multiple API requests. This is leading to performance issues and unnecessary load on the server.
Expected Behavior: The application should only send API requests when necessary, such as when new messages are received.
Actual Behavior: The application is continuously sending multiple API requests, as shown in the attached screenshot.
my code : const subscribeToBotMessages = useCallback(() => { if (!directLine) return;
}, [directLine, conversationId]);
@billba