Commit Graph

13 Commits

Author SHA1 Message Date
Fabian @ Blax Software 737954ba2d fix(ws): don't strand sends when a connection attempt fails (0.3.2)
A page's send() queued behind a failing first connect hung forever — the
close handler dropped the ensureConnected() waiter without settling it, and
a throttled connect() was silently skipped, so nothing ever reconnected.
Symptom in apps: sidebar renders, page body stays blank until a reload.

- ensureConnected(): one waiter per outage, resolved by whichever attempt
  succeeds next (no longer orphaned by a failed attempt)
- connect(): a call that lands on the reconnect throttle is retried when the
  window opens instead of being dropped
- a replaced (connect(true)) or destroy()ed socket's late error/close no
  longer wipes the live socket's state or schedules a reconnect
- destroy() cancels a pending auto-reconnect
- new opt-in `rejectOnDisconnect`: a send already written to a socket that
  closes rejects with { message, code: 'connection_lost' } instead of
  hanging (default off — unchanged behaviour for existing consumers)
- node:test suite (`npm test`) with a scripted fake socket covering each case

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-24 09:46:52 +02:00
Fabian @ Blax Software c21553536f fix(ws): resolve a function `url` lazily — don't invoke the getter at construction
createWsClient eagerly invoked a function-form `config.url` to print a dev-time
URL-validation warning. For a module-scope singleton built with
`createVueWsClient({ url: () => useRuntimeConfig().public... })`, that called
useRuntimeConfig() at import time — outside any Nuxt context — and threw
"A composable that requires access to the Nuxt instance was called outside of a
plugin, Nuxt hook, Nuxt middleware, or Vue setup function" (regression vs 0.2.x).

Now only STRING urls are validated eagerly; a function url stays lazy and is
resolved in _getUrl() at connect time (as in 0.2.x). Bump 0.3.1.
2026-06-30 11:53:40 +02:00
Fabian @ Blax Software 1d8f43148f docs(agents): add AGENTS.md client reference, ship it via files[], fix ApiClient method names
- AGENTS.md: canonical client reference — factories + the app `ws` singleton, send()
  (streaming via the 4th progress arg, no-timeout caveat), listen/listenWhileMounted,
  the EventTarget mechanics, the setAppReady() gate, the SSR pattern, and a footgun checklist.
- package.json: add AGENTS.md to files[] so it ships to node_modules in consumer installs.
- README: correct the ApiClient method table — `bearerToken` getter / getBackendUrl() /
  setBearer(null) (getBearer/getServerUrl/clearBearer never existed) + accurate verb signatures.
2026-06-30 10:56:33 +02:00
Fabian @ Blax Software bfb32a8599 docs: add star history section
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-05 16:44:35 +02:00
Fabian @ Blax Software cca10c6061 fix: call setAppReady() automatically in createFromNuxtConfig 2026-04-16 08:52:52 +02:00
Fabian @ Blax Software 34f9d8fd81 feat: expose ws globally for console debugging 2026-04-16 08:48:19 +02:00
Fabian @ Blax Software 448b1770fc chore: revert dist/ commit, add prepare script for git installs 2026-04-16 08:38:03 +02:00
Fabian @ Blax Software afc205d65b chore: include dist/ in repo for GitHub-based installs 2026-04-16 08:36:18 +02:00
Fabian @ Blax Software 8e4eb5e16e chore: bump to 0.3.0 2026-04-16 08:31:50 +02:00
Fabian @ Blax Software fed6ee0d11 chore: default appKey to 'websocket', add copilot instructions 2026-04-16 08:27:22 +02:00
Fabian @ Blax Software 46ce034aba feat: configurable appKey, URL validation, connection diagnostics
- types: add appKey to WsClientConfig
- nuxt: read PUSHER_APP_KEY from runtimeConfig, validate wsUrl/appKey
- ws: URL validation, debug logging, 5s connection_established timeout
2026-04-16 08:17:56 +02:00
Fabian @ Blax Software e80b3d09b1 I listenwhilemounted, U 0.2.0 2026-04-07 09:12:38 +02:00
Fabian @ Blax Software 1c3c618c27 Init 2026-04-07 08:44:00 +02:00