PacketHeader class
Structure of a packet header:
- 1 byte: forwards count
- 1 byte: packet type
- 6 bytes: issuedAt (Unix timestamp with milliseconds)
- 8 bytes: message id (int)
Total header length: 16 bytes
- Annotations
-
- @immutable
Constructors
- PacketHeader({required int id, required int issuedAt, int forwardsCount = 0, PacketType messageType = PacketType.regular})
-
const
- PacketHeader.fromBytes(Uint8List datagram)
-
factory
Properties
- forwardsCount → int
-
The number of times the packet has been forwarded.
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- id → int
-
The unique identifier of the packet.
final
- issuedAt → int
-
The timestamp when the packet was issued
(Unix timestamp with milliseconds).
final
- messageType → PacketType
-
The type of the packet.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
copyWith(
{int? issuedAt, int? id, PacketType? messageType}) → PacketHeader -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toBytes(
) → Uint8List -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override
Static Methods
-
setForwardsCount(
int count, Uint8List datagram) → Uint8List