Skip to content

KeyedRegistry

Defined in: packages/net-core/src/keyed-registry.ts:26

Key-based ExchangeRegistry for protocols that answer out of order.

MQTT packet identifiers, JSON-RPC ids, DNS transaction identifiers, RTMP transaction identifiers and AMQP channel identifiers all correlate this way, and none of them can be served by an order-based registry: a response to the third request may legitimately arrive first.

In

Inbound frame type.

Key

Correlation key type, anything usable as a Map key.

new KeyedRegistry<In, Key>(options): KeyedRegistry<In, Key>

Defined in: packages/net-core/src/keyed-registry.ts:31

KeyedRegistryOptions<In, Key>

KeyedRegistry<In, Key>

get size(): number

Defined in: packages/net-core/src/keyed-registry.ts:35

Number of exchanges currently outstanding, including tombstones.

number

Number of exchanges currently outstanding, including tombstones.

ExchangeRegistry.size

offer(frame, body?): boolean

Defined in: packages/net-core/src/keyed-registry.ts:57

Offer an inbound frame to the outstanding exchanges.

In

The decoded frame.

ReadableStream<Uint8Array<ArrayBufferLike>>

Streamed payload declared by the codec, if any.

boolean

true if an exchange claimed the frame, false if it should be treated as unsolicited.

ExchangeRegistry.offer


register(exchange, key?): void

Defined in: packages/net-core/src/keyed-registry.ts:47

Track an exchange under the key the peer will echo back.

PendingExchange<In>

The exchange awaiting a response.

Key

The correlation key.

void

If no key was supplied, since positional matching is not meaningful for a protocol that answers out of order.

ExchangeRegistry.register


rejectAll(error): void

Defined in: packages/net-core/src/keyed-registry.ts:94

Fail every outstanding exchange, for example when the connection drops.

Error

The reason to reject with.

void

ExchangeRegistry.rejectAll


remove(exchange): void

Defined in: packages/net-core/src/keyed-registry.ts:85

Stop tracking an exchange without completing it.

PendingExchange<In>

The exchange to drop.

void

ExchangeRegistry.remove