mirror of
https://github.com/appwrite/console.git
synced 2026-06-06 19:27:48 +00:00
Fix WebSocket connection check in Synapse component
This commit is contained in:
@@ -198,9 +198,12 @@ export class Synapse {
|
||||
if (!noReturn) this.ws.addEventListener('message', callback);
|
||||
else resolve(null);
|
||||
});
|
||||
|
||||
// check if websocket is connected
|
||||
if (!this.ws || this.ws.readyState !== WebSocket.OPEN) {
|
||||
throw new Error('WebSocket is not connected');
|
||||
if (this.ws?.readyState !== WebSocket.OPEN) {
|
||||
await this.isConnected();
|
||||
if (this.ws?.readyState !== WebSocket.OPEN)
|
||||
throw new Error('WebSocket is not connected');
|
||||
}
|
||||
this.ws.send(JSON.stringify(message));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user