PusherChannelsClient.custom constructor

PusherChannelsClient.custom({
  1. required PusherChannelsConnectionDelegate connectionDelegate,
  2. required PusherChannelsClientLifeCycleConnectionErrorHandler connectionErrorHandler,
  3. Duration minimumReconnectDelayDuration = const Duration(seconds: 1),
  4. Duration defaultActivityDuration = kPusherChannelsDefaultActivityDuration,
  5. Duration? activityDurationOverride,
  6. 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 nor activityDurationOverride are provided.
  • activityDurationOverride : Overrides both the server activity timeout and defaultActivityDuration.
  • waitForPongDuration : A timeout duration that is used to wait for the pong event right after controller sends the ping 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,
    );