Client class
A client that can connect to a Server.
Properties
-
clientConnected
↔ Event<
ClientConnectedEventArgs> -
Invoked when another non-localclient connects.
getter/setter pair
-
clientDisconnected
↔ Event<
ClientDisconnectedEventArgs> -
Invoked when another non-local client disconnects.
getter/setter pair
- connected ↔ Event
-
Invoked when a connection to the server is established.
getter/setter pair
- connection → Connection?
-
The client's connection to a server.
Not an auto property because properties can't be passed as ref/out parameters. Could
use a local variable in the Connect method, but that's arguably not any cleaner. This
property will also probably only be used rarely from outside the class/library.
no setter
-
connectionFailed
↔ Event<
ConnectionFailedEventArgs> -
Invoked when a connection to the server fails to be established.
getter/setter pair
- connectTimeoutTime ↔ int
-
The time (in milliseconds) for which to wait before giving up on a connection attempt.
getter/setter pairinherited
- currentTime → int
-
no setterinherited
- defaultTimeout ↔ int
-
The default time (in milliseconds) after which to disconnect if no heartbeats are received.
getter/setter pairinherited
-
disconnected
↔ Event<
DisconnectedEventArgs> -
Invoked when disconnected from the server.
getter/setter pair
-
eventQueue
→ PriorityQueue<
(DelayedEvent, int)> -
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- heartbeatInterval ↔ int
-
The interval (in milliseconds) at which to send and expect heartbeats to be received.
getter/setter pairinherited
- id → int
-
The client's numeric ID.
no setter
- isConnected → bool
-
Whether or not the client is currently connected.
no setter
- isConnecting → bool
-
Whether or not the client is currently in the process of connecting.
no setter
- isNotConnected → bool
-
Whether or not the client is currently not trying to connect, pending, nor actively connected.
no setter
- isPending → bool
-
Whether or not the client's connection is currently pending (waiting to be accepted/rejected by the server).
no setter
- logName ↔ String
-
The name to use when logging messages via RiptideLogger.
getter/setter pairinherited
-
messageReceived
↔ Event<
MessageReceivedEventArgs> -
Invoked when a message is received.
getter/setter pair
-
messageToHandle
→ Queue<
MessageToHandle> -
no setterinherited
- rtt → int
-
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- smoothRtt → int
-
This value is slower to accurately represent lasting changes in latency than rtt, but it is less susceptible to changing drastically due to significant—but temporary—jumps in latency.
no setter
- time → Stopwatch
-
no setterinherited
- timeoutTime ↔ int
-
Sets the relevant connections'
Connection.timeoutTime
s.getter/setter pairinherited-getter - useMessageHandlers ↔ bool
-
Whether or not the peer should use the subscription based message handler system.
getter/setter pairinherited
Methods
-
changeTransport(
IClient newTransport) → void - Disconnects the client if it's connected and swaps out the transport it's using.
-
connect(
InternetAddress hostAddress, int port, {int maxConnectionAttempts = 5, Message? message, bool useMessageHandlers = true}) → Future< bool> - Attempts to connect to a server at the given host address.
-
decreaseActiveCount(
) → void -
Decreases
activeCount
>. For use when a Server or Client is stopped.inherited -
disconnect(
) → void - Disconnects from the server.
-
disconnectConnection(
Connection connection, DisconnectReason reason) → void - Disconnects from the server.
-
executeLater(
int delay, DelayedEvent event) → void -
Sets up a delayed event to be executed after the given time has passed
inherited
-
handle(
Message message, MessageHeader header, Connection connection) → void - Handles a message
-
handleData(
DataReceivedEventArgs e) → void -
Handles data received by the transport
inherited
-
handleMessages(
) → void -
Handles all queued messages
inherited
-
heartbeat(
) → void - Beats the heart
-
increaseActiveCount(
) → void -
Increases
activeCount
. For use when a new Server or Client is started.inherited -
localDisconnect(
DisconnectReason reason, {Message? message, RejectReason rejectReason = RejectReason.noConnection}) → void - Cleans up the local side of the connection.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerMessageHandler(
int messageID, dynamic callback(Message message)) → void -
Registers a callback handler for a specifc
messageID
when messages with this particular id are received. -
removeMessageHandler(
int messageID) → void -
Removes the callback handler for a certain
messageID
. -
send(
Message message, [bool shouldRelease = true]) → void - Sends a message to the server.
-
startTime(
) → void -
Starts tracking how much time has passed.
inherited
-
stopTime(
) → void -
Stops tracking how much time has passed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
update(
) → void - Handles any received messages and invokes any delayed events which need to be invoked.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited