PusherChannelsClient.custom constructor
PusherChannelsClient.custom({
- required PusherChannelsConnectionDelegate connectionDelegate,
- required PusherChannelsClientLifeCycleConnectionErrorHandler connectionErrorHandler,
- Duration minimumReconnectDelayDuration = const Duration(seconds: 1),
- Duration defaultActivityDuration = kPusherChannelsDefaultActivityDuration,
- Duration? activityDurationOverride,
- Duration waitForPongDuration = kPusherChannelsDefaultWaitForPongDuration,
Providing a client with a delegate returning custom implementation of PusherChannelsConnection. Parameters:
connectionDelegate
: A delegate function that is used by controller to create instances PusherChannelsConnection with each connection try.Note
:DON'T
provide a factory that returns a singleton or a same variable beacause controller closes it's connection after each lifecycle. See the implementation of PusherChannelsWebSocketConnection and PusherChannelsClient.websocket constructor.connectionErrorHandler
: This handler will be called by controller when a connection error is thrown.minimumReconnectDelayDuration
: A minimum delay between connection tries used by controller when reconnecting.defaultActivityDuration
: A default timeout duration of activity that is used by controller to check if connection is alive. The value will be used if neither the server activity timeout noractivityDurationOverride
are provided.activityDurationOverride
: Overrides both the server activity timeout anddefaultActivityDuration
.waitForPongDuration
: A timeout duration that is used to wait for thepong
event right after controller sends theping
message.
Implementation
factory PusherChannelsClient.custom({
required PusherChannelsConnectionDelegate connectionDelegate,
required PusherChannelsClientLifeCycleConnectionErrorHandler
connectionErrorHandler,
Duration minimumReconnectDelayDuration = const Duration(seconds: 1),
Duration defaultActivityDuration = kPusherChannelsDefaultActivityDuration,
Duration? activityDurationOverride,
Duration waitForPongDuration = kPusherChannelsDefaultWaitForPongDuration,
}) =>
PusherChannelsClient._baseWithConnection(
minimumReconnectDelayDuration: minimumReconnectDelayDuration,
waitForPongDuration: waitForPongDuration,
activityDurationOverride: activityDurationOverride,
defaultActivityDuration: defaultActivityDuration,
connectionDelegate: connectionDelegate,
connectionErrorHandler: connectionErrorHandler,
);