feat(rivetkit): add getParams for dynamic connection parameters#4473
feat(rivetkit): add getParams for dynamic connection parameters#4473NathanFlurry merged 3 commits intomainfrom
Conversation
Adds a getParams callback option to QueryOptions that is called each time a new connection is opened. This enables patterns like refreshing a JWT on every connection or reconnect. Errors from getParams are surfaced as ActorError with code 'get_params_failed' and allow the connection to retry. Includes new driver tests to verify getParams is called per connection and that errors are properly surfaced and retried. Documentation updated across authentication, connections, and client JavaScript pages.
|
🚅 Deployed to the rivet-pr-4473 environment in rivet-frontend
|
getParams was only wired into connect() and webSocket(). This meant action(), send(), and fetch() would silently omit connection params when only getParams was provided, breaking authentication for those code paths.
PR Review: feat(rivetkit): add getParams for dynamic connection parametersOverall this is a well-structured feature with good test coverage. A few issues worth addressing. Bug: Inconsistent error handling between ActorConnRaw and ActorHandleRaw In actor-conn.ts, In actor-handle.ts, Docs: Examples replace In Minor: The type Test gap: The new tests cover the WebSocket Nit: Redundant
|
PR Review: feat(rivetkit): add getParams for dynamic connection parametersThe feature is well-motivated and the overall design is sound. A few issues worth addressing. Bug: Asymmetric error handling in
|
…ods" This reverts commit 3304172.
Description
Adds a
getParamscallback option toQueryOptionsthat is lazily evaluated each time a new connection is opened. This enables patterns like refreshing JWT tokens on every connection or reconnect.Type of change
How Has This Been Tested?
Added two new integration tests in the driver test suite:
getParamsis called once per connection with fresh valuesgetParamserrors are surfaced asActorErrorwith codeget_params_failedand that the connection retries successfullyImplementation Details
getParamsis called immediately before opening a WebSocket connectiongetParamsclear the message queue, reject pending promises, and dispatch anActorErrorparamsandgetParamscan be provided;getParamstakes precedence for connection-based flowsChecklist: