zetrix_ws_disconnect
Disconnect from WebSocket connections to stop receiving real-time blockchain updates from the Zetrix network.
Instructions
Disconnect from WebSocket
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:1110-1121 (handler)Handler function that executes the zetrix_ws_disconnect tool by getting the WebSocket client singleton and calling its disconnect method.case "zetrix_ws_disconnect": { const wsClient = getWebSocketClient(); wsClient.disconnect(); return { content: [ { type: "text", text: "WebSocket disconnected successfully", }, ], }; }
- src/index.ts:404-411 (registration)Tool registration entry in the tools array, including name, description, and input schema (empty object). This is used by ListToolsRequestSchema.{ name: "zetrix_ws_disconnect", description: "Disconnect from WebSocket", inputSchema: { type: "object", properties: {}, }, },
- src/index.ts:50-58 (helper)Singleton helper function to get or create the ZetrixWebSocketClient instance used by the tool.let zetrixWsClient: ZetrixWebSocketClient | null = null; function getWebSocketClient(): ZetrixWebSocketClient { if (!zetrixWsClient) { const wsUrl = ZETRIX_WS_URL || WS_NETWORK_URLS[ZETRIX_NETWORK]; zetrixWsClient = new ZetrixWebSocketClient(wsUrl); } return zetrixWsClient; }
- src/zetrix-websocket.ts:308-314 (helper)Core disconnect implementation in ZetrixWebSocketClient class that closes the WebSocket connection, nullifies the reference, and resets registration status.disconnect() { if (this.ws) { this.ws.close(); this.ws = null; this.isRegistered = false; } }