mirror of
https://github.com/ItzCrazyKns/Perplexica.git
synced 2025-06-22 17:58:31 +00:00
feat(chat): prevent ws not open errors
This commit is contained in:
@ -78,6 +78,18 @@ export const handleConnection = async (
|
||||
ws.close();
|
||||
}
|
||||
|
||||
const interval = setInterval(() => {
|
||||
if (ws.readyState === ws.OPEN) {
|
||||
ws.send(
|
||||
JSON.stringify({
|
||||
type: 'signal',
|
||||
data: 'open',
|
||||
}),
|
||||
);
|
||||
clearInterval(interval);
|
||||
}
|
||||
}, 5);
|
||||
|
||||
ws.on(
|
||||
'message',
|
||||
async (message) =>
|
||||
|
Reference in New Issue
Block a user