Skip to content

feat(vue): allow extra params in ws subscribe messages#43

Open
BatLeDev wants to merge 1 commit into
mainfrom
feat-ws-subscribe-params
Open

feat(vue): allow extra params in ws subscribe messages#43
BatLeDev wants to merge 1 commit into
mainfrom
feat-ws-subscribe-params

Conversation

@BatLeDev

Copy link
Copy Markdown
Member

useWS().subscribe gains an optional third argument params — an opaque bag of fields merged into the subscribe message ({ type: 'subscribe', channel, ...params }). The params are remembered per channel and replayed when the socket reconnects and re-subscribes, then dropped on unsubscribe. lib-vue stays agnostic about what they mean.

Why: a consumer (data-fair) needs an unauthenticated client — a visualization opened through a protected-link application key — to subscribe to a dataset's realtime channels (journal, task-progress). A browser WebSocket handshake carries no Referer, so the application key cannot reach the server the way it does over HTTP; passing it in the subscribe message is the way in. This gives the consumer a generic transport (subscribe(channel, cb, { applicationKey })) without lib-vue knowing about application keys.

Regression risks:

  • subscribe gains an optional third parameter — backward compatible, existing two-arg calls are unaffected.
  • Only the subscribe message shape changes, and only when params is provided; the reconnect-replay and unsubscribe paths now also carry then clear these params. No exports renamed or removed.

useWS().subscribe now accepts an optional opaque params object that is
merged into the subscribe message and replayed on reconnect. This lets a
consumer authorize a channel for an unauthenticated client (e.g. data-fair
passing an applicationKey to subscribe to a dataset journal/task-progress
behind a protected-link application key) without lib-vue knowing about any
specific auth scheme.
@BatLeDev BatLeDev force-pushed the feat-ws-subscribe-params branch from e12939e to 98d7567 Compare June 30, 2026 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant