zetrix_ws_status
Check WebSocket connection status for real-time blockchain updates on the Zetrix network.
Instructions
Check WebSocket connection status
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:1123-1137 (handler)Handler implementation for the 'zetrix_ws_status' tool. Retrieves the WebSocket client instance and returns its connection status along with the WS URL.case "zetrix_ws_status": { const wsClient = getWebSocketClient(); const isConnected = wsClient.isConnected(); return { content: [ { type: "text", text: JSON.stringify({ connected: isConnected, wsUrl: ZETRIX_WS_URL || WS_NETWORK_URLS[ZETRIX_NETWORK], }, null, 2), }, ], }; }
- src/index.ts:412-419 (schema)Tool schema definition for 'zetrix_ws_status', including name, description, and empty input schema (no parameters required).{ name: "zetrix_ws_status", description: "Check WebSocket connection status", inputSchema: { type: "object", properties: {}, }, },
- src/zetrix-websocket.ts:316-318 (helper)Core helper method 'isConnected()' in ZetrixWebSocketClient class that checks if WebSocket is open and registered, providing the actual status logic used by the tool.isConnected(): boolean { return this.ws?.readyState === WebSocket.OPEN && this.isRegistered; }
- src/index.ts:52-58 (helper)Singleton factory function 'getWebSocketClient()' that lazily initializes and returns the shared ZetrixWebSocketClient instance used by the tool.function getWebSocketClient(): ZetrixWebSocketClient { if (!zetrixWsClient) { const wsUrl = ZETRIX_WS_URL || WS_NETWORK_URLS[ZETRIX_NETWORK]; zetrixWsClient = new ZetrixWebSocketClient(wsUrl); } return zetrixWsClient; }