feat(chatModal): add support for secure websockets (wss) in production environment

This commit is contained in:
Gabriel Almeida 2023-05-02 15:04:01 -03:00
commit 9ffa88a773

View file

@ -59,7 +59,9 @@ export default function ChatModal({
const urlWs =
process.env.NODE_ENV === "development"
? `ws://localhost:7860/chat/${flow.id}`
: `ws://${window.location.host}/chat/${flow.id}`;
: `${window.location.protocol === "https:" ? "wss" : "ws"}://${
window.location.host
}/chat/${flow.id}`;
const newWs = new WebSocket(urlWs);
newWs.onopen = () => {