Skip to content

v0.1.6

Choose a tag to compare

@joeblau joeblau released this 28 Jul 13:20
· 8 commits to main since this release
bf2d59f

What's changed

A single fix, for a bug that made one of the most-used subscriptions unusable.

allMids() never resolved

client.allMids() — with no arguments, or with dex: "" — never resolved. It rejected with WebSocketRequestError: Request timed out after the configured timeout, or hung forever when timeout was null. Only a non-empty dex worked, so the main-dex mid-price feed was unusable.

The chain:

  1. allMids builds its payload as { type: "allMids", dex: params.dex || undefined }, so dex exists as an own key holding undefined.
  2. The request normalizer walks Object.keys() and faithfully recreates that key, so the subscription's normalized form carries dex: undefined.
  3. JSON.stringify drops it on the way out — the server receives {"type":"allMids"} and echoes back exactly that.
  4. Echo matching requires every key of the pending request to be present in the response. It looks for a dex the server was never told about, finds nothing, and the subscription is never matched to its own confirmation.

Fixed in the normalizer rather than in allMids: a key whose value is undefined cannot survive serialization, so keeping it leaves the in-memory identity describing a request that was never sent. Dropping it makes the id, the echo and the wire frame agree, and immunizes any future payload built with the same x || undefined shape.

Note on coverage

No test caught this because the only allMids test needs the live network and is skipped in the offline suite. The regression test added here covers the root cause and runs offline. If you subscribe to allMids, upgrading from 0.1.5 is the difference between the channel working and not.