mirror of
https://github.com/wisplite/tether-ts.git
synced 2026-05-01 06:22:41 -05:00
ahhhh
This commit is contained in:
Vendored
+1
@@ -8,6 +8,7 @@ export declare class WebSocketHandler {
|
||||
private maxReconnectAttempts;
|
||||
private reconnectInterval;
|
||||
private sendQueue;
|
||||
onMutation: (data: any) => void;
|
||||
startConnection: (url: string) => void;
|
||||
attemptReconnect: () => void;
|
||||
close: () => void;
|
||||
|
||||
Vendored
+4
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user