Repository navigation
WebSocket client 0.3.0
The third release of the HostLoom WebSocket client. A busy subscription could make the client disconnect itself: with a credit of two, it sent a replenishment frame for every event, and automatic credit and acknowledgements could exceed the gateway's control-frame budget and close the connection with 1008 rate_limited. The client now coalesces those frames per subscription and paces them against a connection-wide budget. A second fix closes a lifecycle race: calling close(), then connect(), then close() again used to open a replacement socket after the caller had decided to stop; the queued connect now rejects instead.
Upgrading from 0.2.0 changes behaviour an application can observe. Credit and acknowledgements are sent after the current task and may wait for budget. acknowledge() skips progress already covered, and a failed send faults the subscription instead of throwing from the call. The new maximumControlFramesPerSecond option defaults to 50, matching the gateway; set it to the gateway's configured limit if that differs. Size subscription credit for the event rate and number of subscriptions: when credit runs out, the gateway drops live events, and acknowledgements do not provide replay.
This release publishes @hostloom/websocket-client 0.3.0 through its independent npm release stream. It keeps the JSON-v1 protocol and dependency-free ESM output with TypeScript declarations; no NuGet packages are published by this release.
Added
- The
maximumControlFramesPerSecondconnection option, 50 by default, configures the gateway control-frame limit used to pace automatic credit and acknowledgements.
Changed
- Credit and acknowledgement frames are coalesced per subscription and sent after the current task. Every outgoing control frame draws on the shared budget; automatic credit and acknowledgements wait while it is spent. With the default setting, the pacing allows a burst of five frames and refills at twenty per second.
acknowledge(sequence)keeps the highest pending sequence and skips sequences already acknowledged. A failed acknowledgement send ends the subscription with an error instead of throwing synchronously fromacknowledge().- Applications on busy topics should allow enough credit for the time between replenishments. With the default low watermark, ten subscriptions receiving twenty events per second each and using credit 32 need about twelve credit frames per second; acknowledgements consume additional budget.
Fixed
- Automatic credit and acknowledgements no longer send a frame for every event on a credit-two subscription and exhaust the gateway's default control-frame budget at ordinary event rates.
- A
close()during an earlier close rejects aconnect()queued behind it withHostLoomConnectionClosedError, preventing a replacement socket from opening after the caller closes again.
Security
- Publication uses the package's npm trusted publisher through GitHub OIDC, without an npm write token. The release workflow publishes the exact tarball produced by its verification job and refuses a publishing dispatch from a branch whose name resembles a release tag.