TransportConnection class

Provides universal API for transport connections. Transport connection is a low-level object that wraps a connection method and exposes a simple evented interface for the connection state and messaging. It does not implement Pusher-specific WebSocket protocol. Additionally, it fetches resources needed for transport to work and exposes an interface for querying transport features. States:

  • new - initial state after constructing the object
  • initializing - during initialization phase, usually fetching resources
  • intialized - ready to establish a connection
  • connection - when connection is being established
  • open - when connection ready to be used
  • closed - after connection was closed be either side Emits:
  • error - after the connection raised an error Options:
  • useTLS - whether connection should be over TLS
  • hostTLS - host to connect to when connection is over TLS
  • hostNonTLS - host to connect to when connection is over TLS
Inheritance
Annotations
  • @JS()

Constructors

TransportConnection(TransportHooks hooks, String name, num priority, String key, TransportConnectionOptions options)
factory

Properties

activityTimeout num
getter/setter pair
beforeOpen Function
getter/setter pair
callbacks CallbackRegistry
getter/setter pairinherited
failThrough Function
getter/setter pairinherited
global_callbacks List<Function>
getter/setter pairinherited
hashCode int
The hash code for this object.
no setterinherited
hooks TransportHooks
getter/setter pair
id num
getter/setter pair
initialize Function
getter/setter pair
key String
getter/setter pair
name String
getter/setter pair
options TransportConnectionOptions
getter/setter pair
priority num
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
socket Socket
getter/setter pair
state String
getter/setter pair
timeline Timeline
getter/setter pair

Methods

bind(String eventName, Function callback, [dynamic context]) → dynamic
inherited
bind_global(Function callback) → dynamic
inherited
bindListeners() → dynamic
buildTimelineMessage(dynamic message) → dynamic
changeState(String state, [dynamic params]) → dynamic
close() bool
Closes the connection.
connect() bool
Tries to establish a connection.
emit(String eventName, [dynamic data, Metadata metadata]) Dispatcher
inherited
handlesActivityChecks() bool
Checks whether the transport handles activity checks by itself.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onActivity() → dynamic
onClose([dynamic closeEvent]) → dynamic
onError(dynamic error) → dynamic
onMessage(dynamic message) → dynamic
onOpen() → dynamic
ping() → dynamic
Sends a ping if the connection is open and transport supports it.
send(dynamic data) bool
Sends data over the open connection.
supportsPing() bool
Checks whether the transport supports the ping/pong API.
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
unbindListeners() → dynamic

Operators

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