Imperative PipelineConnection handle.
import { createPipelineStore } from "@playlive/realtime-pipeline/store";
import { createPipelineConnection } from "@playlive/realtime-pipeline/connection";
const store = createPipelineStore({ initialCampaignIDs: ["abc-123"] });
const conn = createPipelineConnection({ store, autoConnect: true });
conn.on("open", () => console.log("pipeline connected"));
conn.on("close", (info) => console.log("pipeline closed", info));
Create a framework-agnostic WebSocket connection bound to a vanilla Zustand pipeline store. Returns an imperative handle plus a typed event emitter — no React, no Solid, no framework coupling.
Internally manages:
WebSocket, handlesonopen/onclose/onerror/onmessageby emitting events and updatingstore._setConnectionState.maxReconnectAttempts) with full jitter. Emits"reconnect-stop"when exhausted.addCampaign/setOverlayInfo/ etc. call triggers a fresh identify.store.refresh()the same way identify is.processMessage(store, raw)which mutates the store.