getChannelPoolingChannelCreator

function getChannelPoolingChannelCreator<TChannelCreator>(
    createChannel,
    __namedParameters,
): TChannelCreator;

Given a channel creator, will return a new channel creator with the following behavior.

  1. When called, returns a RpcSubscriptionsChannel. Adds that channel to a pool.
  2. When called again, creates and returns new RpcSubscriptionChannel | RpcSubscriptionChannels up to the number specified by minChannels.
  3. When minChannels channels have been created, subsequent calls vend whichever existing channel from the pool has the fewest subscribers, or the next one in rotation in the event of a tie.
  4. Once all channels carry the number of subscribers specified by the number maxSubscriptionsPerChannel, new channels in excess of minChannel will be created, returned, and added to the pool.
  5. A channel will be destroyed once all of its subscribers' abort signals fire.

Type Parameters

Type Parameter
TChannelCreator extends RpcSubscriptionsChannelCreator<unknown, unknown>

Parameters

ParameterType
createChannelTChannelCreator
__namedParametersConfig

Returns

TChannelCreator

On this page