From 6bf54309ce2f437507396bb1fe57616453df8082 Mon Sep 17 00:00:00 2001 From: wisplite Date: Wed, 8 Apr 2026 15:07:47 -0500 Subject: [PATCH] send subscription packets --- src/index.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/index.ts b/src/index.ts index 494e3d1..eaa6765 100644 --- a/src/index.ts +++ b/src/index.ts @@ -34,10 +34,24 @@ export class TetherClient { subscribe = (query: string, callback: (data: any) => void) => { this.subscribedQueries.set(query, callback); + if (!this.ws) { + throw new Error('Not connected to Tether'); + } + this.ws.send(JSON.stringify({ + type: 'subscribe', + query: query + })); }; unsubscribe = (query: string) => { this.subscribedQueries.delete(query); + if (!this.ws) { + throw new Error('Not connected to Tether'); + } + this.ws.send(JSON.stringify({ + type: 'unsubscribe', + query: query + })); }; sendMutation = (mutationName: string, params: any) => {