mirror of
https://github.com/ItzCrazyKns/Perplexica.git
synced 2025-06-21 09:18:34 +00:00
Compare commits
3 Commits
admin-pass
...
07c50a02c5
Author | SHA1 | Date | |
---|---|---|---|
07c50a02c5 | |||
728919f7bf | |||
68048dfd56 |
@ -377,11 +377,16 @@ const ChatWindow = ({ id }: { id?: string }) => {
|
||||
const [isReady, setIsReady] = useState(false);
|
||||
|
||||
const [isWSReady, setIsWSReady] = useState(false);
|
||||
const ws = useSocket(
|
||||
process.env.NEXT_PUBLIC_WS_URL!,
|
||||
setIsWSReady,
|
||||
setHasError,
|
||||
);
|
||||
|
||||
let websocketUrl = process.env.NEXT_PUBLIC_WS_URL!;
|
||||
if (websocketUrl.startsWith('/')) {
|
||||
const protocol = window.location.protocol === 'https:' ? 'wss://' : 'ws://';
|
||||
const host = window.location.host;
|
||||
const path = websocketUrl;
|
||||
websocketUrl = `${protocol}${host}${path}`;
|
||||
}
|
||||
|
||||
const ws = useSocket(websocketUrl, setIsWSReady, setHasError);
|
||||
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [messageAppeared, setMessageAppeared] = useState(false);
|
||||
|
Reference in New Issue
Block a user