microsoft / BotFramework-WebChat

A highly-customizable web-based client for Azure Bot Services.
https://www.botframework.com/
MIT License
1.56k stars 1.51k forks source link

Minimizable Webchat (re-render) #4831

Open AxinDev opened 11 months ago

AxinDev commented 11 months ago

I have a question

How can i establish already established connection and re-render webchat without creating a new directLine instance for the same token , i am facing issue that since the token doesn't change from second time , my webchat(reactwebchat) component is not rendering and showing blank page ?

AxinDev commented 11 months ago

I am initializing directLine in minimizableWebchat.js and passing it down as props to webchat.js, and i dont want to create a directLine again , since it is establishing new conversation api call?

compulim commented 10 months ago

This need time to investigate and learn new things. Web Chat can't use cookie or any type of storage. Period.

We did an experiment awhile ago. The best approach is to use a SharedWorker and put the Direct Line connection object there. However, we need to fix Web Chat or Direct Line somewhere... every time the UI render, it will ask Direct Line to connect.

IIRC, this is doable, but it's just not very trivial. Also, need to experiment with different browsers to see how SharedWorker behaves... Safari may not like it.