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, int? resumeAfter})
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
lastIssuedId → int
The id handed out most recently, for a transport that has to CONTINUE this sequence on a fresh connection rather than restart it.
no setter
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
releaseAll() → void
Frees every active id, keeping the lastIssuedId cursor.
releaseId(int streamId) → bool
Releases an ID after stream completion.
resumeAfter(int streamId) → void
Moves the cursor forward so the next id follows streamId.
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).