ConnectionManager class

Manages connection to Pusher. Uses a strategy (currently only default), timers and network availability info to establish a connection and export its state. In case of failures, manages reconnection attempts. Exports state changes as following events:

  • "state_change", { previous: p, current: state }
  • state States:
  • initialized - initial state, never transitioned to
  • connecting - connection is being established
  • connected - connection has been fully established
  • disconnected - on requested disconnection
  • unavailable - after connection timeout or when there's no network
  • failed - when the connection strategy is not supported Options:
  • unavailableTimeout - time to transition to unavailable state
  • activityTimeout - time after which ping message should be sent
  • pongTimeout - time for Pusher to respond with pong before reconnecting
Inheritance
Annotations
  • @JS()

Constructors

ConnectionManager(String key, ConnectionManagerOptions options)
factory

Properties

activityTimeout num
getter/setter pair
activityTimer Timer
getter/setter pair
callbacks CallbackRegistry
getter/setter pairinherited
connection Connection
getter/setter pair
connectionCallbacks ConnectionCallbacks
getter/setter pair
errorCallbacks ErrorCallbacks
getter/setter pair
failThrough Function
getter/setter pairinherited
global_callbacks List<Function>
getter/setter pairinherited
handshakeCallbacks HandshakeCallbacks
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
key String
getter/setter pair
options ConnectionManagerOptions
getter/setter pair
retryTimer Timer
getter/setter pair
runner StrategyRunner
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
socket_id String
getter/setter pair
state String
getter/setter pair
strategy Strategy
getter/setter pair
timeline Timeline
getter/setter pair
unavailableTimer Timer
getter/setter pair
usingTLS bool
getter/setter pair

Methods

abandonConnection() → dynamic
abortConnecting() → dynamic
bind(String eventName, Function callback, [dynamic context]) → dynamic
inherited
bind_global(Function callback) → dynamic
inherited
buildConnectionCallbacks(ErrorCallbacks errorCallbacks) ConnectionCallbacks
buildErrorCallbacks() ErrorCallbacks
buildHandshakeCallbacks(ErrorCallbacks errorCallbacks) HandshakeCallbacks
clearRetryTimer() → dynamic
clearUnavailableTimer() → dynamic
connect() → dynamic
Establishes a connection to Pusher. Does nothing when connection is already established. See top-level doc to find events emitted on connection attempts.
disconnect() → dynamic
Closes the connection.
disconnectInternally() → dynamic
emit(String eventName, [dynamic data, Metadata metadata]) Dispatcher
inherited
isUsingTLS() → dynamic
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resetActivityCheck() → dynamic
retryIn(dynamic delay) → dynamic
send(dynamic data) → dynamic
Sends raw data.
send_event(String name, dynamic data, [String channel]) → dynamic
Sends an event.
sendActivityCheck() → dynamic
setConnection(dynamic connection) → dynamic
setUnavailableTimer() → dynamic
shouldRetry() bool
startConnecting() → dynamic
stopActivityCheck() → dynamic
toString() String
A string representation of this object.
inherited
unbind([String eventName, Function callback, dynamic context]) → dynamic
inherited
unbind_all() → dynamic
inherited
unbind_global([Function callback]) → dynamic
inherited
updateState(String newState, [dynamic data]) → dynamic
updateStrategy() → dynamic

Operators

operator ==(Object other) bool
The equality operator.
inherited