getChannelPoolingChannelCreator
Given a channel creator, will return a new channel creator with the following behavior.
- When called, returns a RpcSubscriptionsChannel. Adds that channel to a pool.
- When called again, creates and returns new
RpcSubscriptionChannel | RpcSubscriptionChannels up to the number specified by
minChannels
. - 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. - Once all channels carry the number of subscribers specified by the number
maxSubscriptionsPerChannel
, new channels in excess ofminChannel
will be created, returned, and added to the pool. - A channel will be destroyed once all of its subscribers' abort signals fire.
Type Parameters
Type Parameter |
---|
TChannelCreator extends RpcSubscriptionsChannelCreator <unknown , unknown > |
Parameters
Parameter | Type |
---|---|
createChannel | TChannelCreator |
__namedParameters | Config |
Returns
TChannelCreator