A Svelte store that synchronizes with a WebSocket backend. Current stable version is 1.2.15, with no specific release cadence (community-maintained). Key differentiators: built on Svelte writable stores, automatic JSON serialization/deserialization, JWT authentication support, and seamless integration with Svelte 5. Peer dependency on Svelte ^5.45.8. Suitable for real-time applications where server state must be mirrored in Svelte components via reactive stores.
npm install svelte-websocket-storeNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to import and use websocketStore, send data via assignment, and read reactive store value.
Upgrade to Svelte 5 and use $store syntax in .svelte files.
Use store's set method or assignment to send data; the library handles the WebSocket lifecycle.
Initialize with a placeholder or handle server message in a derived store.
Use an array of strings for options (e.g., ['jwt', 'reconnect']).
npm install svelte-websocket-store and ensure project uses ESM (type: module or .mjs).
Use import statement instead of require().
Provide an initial value, e.g., websocketStore(url, {}, []).