HubConnection constructor
HubConnection({
- Connection? connection,
- Logging? logging,
- required HubProtocol protocol,
- RetryPolicy? reconnectPolicy,
Implementation
HubConnection({
Connection? connection,
Logging? logging,
required HubProtocol protocol,
RetryPolicy? reconnectPolicy,
}) : _cachedPingMessage = protocol.writeMessage(PingMessage()),
_connection = connection,
_logger = logging,
_protocol = protocol,
_reconnectPolicy = reconnectPolicy {
serverTimeoutInMilliseconds = DEFAULT_TIMEOUT_IN_MS;
keepAliveIntervalInMilliseconds = DEFAULT_PING_INTERVAL_IN_MS;
_handshakeProtocol = HandshakeProtocol();
if (_connection != null) {
_connection!
..onreceive = _processIncomingData
..onclose =
(Exception? exception) => _connectionClosed(exception: exception);
}
_callbacks = {};
_methods = {};
_closedCallbacks = [];
_reconnectingCallbacks = [];
_reconnectedCallbacks = [];
_invocationId = 0;
_receivedHandshakeResponse = false;
_connectionState = HubConnectionState.disconnected;
_connectionStarted = false;
}