RpcStreamIdManager class final

Stream ID manager for HTTP/2 connections.

Generates and tracks stream IDs per HTTP/2 (RFC 7540):

  • Clients use odd IDs (1, 3, 5…)
  • Servers use even IDs (2, 4, 6…)
  • ID 0 is reserved for connection control
  • Max ID is 2^31-1 (2,147,483,647)

When the max ID is reached, released IDs are reused if available; otherwise RpcException is thrown and the transport must wait or reconnect.

Constructors

RpcStreamIdManager({required bool isClient, int? customMaxId})
Creates an ID manager for a given role.

Properties

activeCount int
Number of active IDs.
no setter
hashCode int
The hash code for this object.
no setterinherited
isClient bool
Determines role (client/server) for ID generation.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

generateId() int
Generates a new unique stream ID.
isActive(int streamId) bool
Returns true if the ID is currently active.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
releaseId(int streamId) bool
Releases an ID after stream completion.
reset() → void
Resets manager state (clears active IDs and counters).
toString() String
A string representation of this object.
inherited

Operators

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

Constants

maxId → const int
Maximum allowed ID (2^31-1).