Client Configuration
This documents the old v1 API. See Creating a Client for the current version.
Initialization Options
Section titled “Initialization Options”const client = createZocketClient<AppRouter>("ws://localhost:3000", { headers: { authorization: "Bearer token123", }, onOpen: () => console.log("Connected"), onClose: () => console.log("Disconnected"), debug: process.env.NODE_ENV === "development",});Reconnection Logic
Section titled “Reconnection Logic”client.onClose(() => { setTimeout(() => client.reconnect(), 5000);});Error Handling
Section titled “Error Handling”client.onError((error) => { console.error("WebSocket Error:", error);});Properties: client.readyState, client.lastError.