@instaclaw/dispatch 0.6.0 → 0.6.1

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.
@@ -16,10 +16,17 @@ export function connect(opts) {
16
16
  console.log(` Connecting to ${opts.vmAddress}:${opts.port}...`);
17
17
  ws = new WebSocket(url, {
18
18
  rejectUnauthorized: false, // Accept self-signed certs (TOFU model)
19
+ handshakeTimeout: 10000,
19
20
  });
20
21
  ws.on("open", () => {
21
22
  reconnectDelay = 1000; // Reset backoff
22
23
  console.log(` Connected to agent on ${opts.vmAddress}`);
24
+ // Enable TCP keepalive to prevent NAT/firewall/router from killing idle connections
25
+ // Without this, home routers typically drop idle TCP after 2-5 minutes
26
+ const socket = ws?._socket;
27
+ if (socket?.setKeepAlive) {
28
+ socket.setKeepAlive(true, 30000); // Send TCP keepalive every 30s
29
+ }
23
30
  opts.onConnect?.();
24
31
  });
25
32
  ws.on("message", async (data, isBinary) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instaclaw/dispatch",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "Let your InstaClaw AI agent control your computer — screenshots, clicks, typing, and more via a secure WebSocket relay",
5
5
  "bin": {
6
6
  "instaclaw-dispatch": "./dist/index.js"