openclaw-channel-dmwork 0.2.24 → 0.2.25

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/socket.ts +5 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openclaw-channel-dmwork",
3
- "version": "0.2.24",
3
+ "version": "0.2.25",
4
4
  "description": "DMWork channel plugin for OpenClaw via WuKongIM WebSocket",
5
5
  "main": "index.ts",
6
6
  "type": "module",
package/src/socket.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { EventEmitter } from "events";
2
2
  import WKSDK, { ConnectStatus, type Message } from "wukongimjssdk";
3
+ const getSDK = (): InstanceType<typeof WKSDK> => (WKSDK as any).shared();
3
4
  import type { BotMessage, MessagePayload } from "./types.js";
4
5
 
5
6
  interface WKSocketOptions {
@@ -17,19 +18,18 @@ interface WKSocketOptions {
17
18
  * Thin wrapper around wukongimjssdk — the SDK handles binary encoding,
18
19
  * DH key exchange, encryption, heartbeat, reconnect, and RECVACK.
19
20
  *
20
- * Each WKSocket creates its own WKSDK instance, allowing multiple
21
- * concurrent connections for multi-account setups.
21
+ * Uses WKSDK.shared() singleton the SDK's ConnectManager is global,
22
+ * so only one WebSocket connection is supported at a time.
22
23
  */
23
24
  export class WKSocket extends EventEmitter {
24
- private im: InstanceType<typeof WKSDK>;
25
+ private im!: InstanceType<typeof WKSDK>;
25
26
  private statusListener: ((status: ConnectStatus, reasonCode?: number) => void) | null = null;
26
27
  private messageListener: ((message: Message) => void) | null = null;
27
28
  private connected = false;
28
29
 
29
30
  constructor(private opts: WKSocketOptions) {
30
31
  super();
31
- this.im = new WKSDK();
32
- (this.im as any).init(); // WKSDK constructor is empty; config/managers created in init()
32
+ this.im = getSDK();
33
33
  }
34
34
 
35
35
  /** Connect to WuKongIM WebSocket */