HubConnection class

Represents a connection to a SignalR Hub.

Constructors

HubConnection({Connection? connection, Logging? logging, required HubProtocol protocol, RetryPolicy? reconnectPolicy})

Properties

baseUrl String
Indicates the url of the {@link HubConnection} to the server.
getter/setter pair
connectionId String?
Represents the connection id of the HubConnection on the server. The connection id will be null when the connection is either in the disconnected state or if the negotiation step was skipped.
no setter
hashCode int
The hash code for this object.
no setterinherited
keepAliveIntervalInMilliseconds int
Default interval at which to ping the server.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
serverTimeoutInMilliseconds int
The server timeout in milliseconds.
getter/setter pair
state HubConnectionState?
Indicates the state of the {@link HubConnection} to the server.
no setter

Methods

invoke(String methodName, {List? args}) Future
Invokes a hub method on the server using the specified name and arguments.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
off(String methodName, {MethodInvocationFunc? method}) → void
Removes all handlers for the specified hub method.
on(String methodName, MethodInvocationFunc newMethod) → void
Registers a handler that will be invoked when the hub method with the specified method name is invoked.
onclose(ClosedCallback callback) → void
Registers a handler that will be invoked when the connection is closed.
onreconnected(ReconnectedCallback callback) → void
Registers a handler that will be invoked when the connection successfully reconnects.
onreconnecting(ReconnectingCallback callback) → void
Registers a handler that will be invoked when the connection starts reconnecting.
send({String? methodName, List? args}) Future<void>
Invokes a hub method on the server using the specified name and arguments. Does not wait for a response from the receiver.
start() Future<void>?
Starts the connection.
stop() Future<void>
Stops the connection.
stream<T>(String methodName, {List? args}) Stream<T?>
Invokes a streaming hub method on the server using the specified name and arguments.
toString() String
A string representation of this object.
inherited

Operators

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