From 1159d9a459043b099f231110ae2adeb548e28f71 Mon Sep 17 00:00:00 2001 From: wisplite Date: Thu, 23 Apr 2026 08:48:53 -0500 Subject: [PATCH] need to add build, oops --- dist/index.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index e109a3a..eb97bd6 100644 --- a/dist/index.js +++ b/dist/index.js @@ -6,16 +6,25 @@ export class TetherClient { this.websocketHandler.startConnection(url); this.websocketHandler.onQuery = (location, data) => { if (location) { - const callback = this.subscribedQueries.get(location); + const { callback } = this.subscribedQueries.get(location) || { callback: () => { } }; callback?.(data); } }; + this.websocketHandler.onOpen = () => { + this.subscribedQueries.forEach(({ params }, queryName) => { + this.websocketHandler.send(JSON.stringify({ + type: 'subscribe', + location: queryName, + params: params + })); + }); + }; }; disconnect = () => { this.websocketHandler.close(); }; subscribe = (queryName, params, callback) => { - this.subscribedQueries.set(queryName, callback); + this.subscribedQueries.set(queryName, { callback, params }); this.websocketHandler.send(JSON.stringify({ type: 'subscribe', location: queryName,