@botcord/openclaw-plugin 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/ws-client.ts CHANGED
@@ -13,6 +13,7 @@ import WebSocket from "ws";
13
13
  import { BotCordClient } from "./client.js";
14
14
  import { handleInboxMessage } from "./inbound.js";
15
15
  import { displayPrefix } from "./config.js";
16
+ import { buildHubWebSocketUrl } from "./hub-url.js";
16
17
 
17
18
  interface WsClientOptions {
18
19
  client: BotCordClient;
@@ -73,7 +74,7 @@ export function startWsClient(opts: WsClientOptions): { stop: () => void } {
73
74
  // Get a fresh JWT token
74
75
  const token = await client.ensureToken();
75
76
  const hubUrl = client.getHubUrl();
76
- const wsUrl = hubUrl.replace(/^http/, "ws") + "/hub/ws";
77
+ const wsUrl = buildHubWebSocketUrl(hubUrl);
77
78
 
78
79
  log?.info(`[${dp}] WebSocket connecting to ${wsUrl}`);
79
80
  ws = new WebSocket(wsUrl);
@@ -184,4 +185,3 @@ export function stopWsClient(accountId: string): void {
184
185
  const entry = activeWsClients.get(accountId);
185
186
  if (entry) entry.stop();
186
187
  }
187
-