This commit is contained in:
2026-04-23 08:51:36 -05:00
parent 44fe4c63c4
commit 6ee7b5ac34
4 changed files with 18 additions and 1 deletions
+4
View File
@@ -8,6 +8,7 @@ export class WebSocketHandler {
maxReconnectAttempts = 5;
reconnectInterval = 1000;
sendQueue = [];
onMutation = () => { };
startConnection = (url) => {
this.url = url;
this.ws = new WebSocket(url);
@@ -26,6 +27,9 @@ export class WebSocketHandler {
if (data.type === 'query') {
this.onQuery(data.location, data.data);
}
else if (data.type === 'mutation') {
this.onMutation(data.data);
}
else if (data.type === 'error') {
console.error(data.error);
}