Connection class abstract
Base class for all MTProto transport connections on native platforms.
Uses raw TCP sockets via dart:io. Subclasses must implement createCodec to provide the appropriate PacketCodec for their transport mode.
Constructors
- Connection(String ip, int port, int dcId)
-
Creates a connection to the given
ip:porton data centerdcId.
Properties
- dcId → int
-
The data center ID.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- ip → String
-
The IP address of the Telegram DC to connect to.
final
- isConnected → bool
-
Whether the underlying socket is currently connected.
no setter
- port → int
-
The port number of the Telegram DC.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
connect(
{Duration? timeout}) → Future< void> - Establishes a TCP connection and initializes the transport codec.
-
createCodec(
) → PacketCodec - Creates the codec appropriate for this transport mode.
-
disconnect(
) → Future< void> - Closes the connection and releases all resources.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
recv(
) → Future< Uint8List> - Receives one complete TL payload from the connection, decoding it from the transport framing.
-
send(
Uint8List data) → Future< void> -
Sends a TL payload
datathrough the connection, encoding it with the transport codec first. -
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited