GatewayFake class final

Serves /api/v1/gateway on the fake server.

One connection per device: a new identify or resume closes the older connection with 4017. Catch-up runs synchronously after ready or resumed, so no live event can slip between its pages. Every frame the fake sends is checked against asyncapi.yaml; a frame of the client that breaks its schema is recorded and the connection is closed with 4002, as the server does for an unknown member.

Simplifications (README): no heartbeat timeout (4009) and no reauth_required; tests close with any code through the FaultPlan.

Implemented types

Constructors

GatewayFake({required FakeWorld world, required ContractSchemas contract, required DpopVerifier verifier, required GatewayTimings timings, required Uri baseUri()})
Creates the gateway.

Properties

baseUri → Uri Function()
The address of the fake, for the htu of gateway proofs.
final
connections → List<FakeGatewayConnection>
Every connection, in order of opening.
no setter
contract → ContractSchemas
The API documents.
final
frames → List<GatewayFrameRecord>
Every frame in both directions, in order.
final
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
timings → GatewayTimings
The values reported to clients.
final
verifier → DpopVerifier
The DPoP check.
final
violations → List<String>
Contract violations of frames, as text with the pointer.
final
world → FakeWorld
The world.
final

Methods

accept(WebSocket socket) → void
Takes over socket after the upgrade and sends hello.
close() → Future<void>
Closes every connection with 1001 and stops the timers.
closeAll(int code, String? reason) → void
Closes every open gateway connection with code and reason.
override
disconnect({String? deviceId}) → void
Ends the connections of deviceId (every connection when null) without a close code, as a lost network does.
duplicateNextDispatch() → void
Sends the next dispatch frame twice.
override
endStatsSubscriptions(String principalId, {String code = 'forbidden'}) → void
Ends the stats.live subscription of every connection of principalId with one error {op: stats.subscribe} with code, as the server does when stats.read is lost (25 5.1 item 3).
forceResync(String reason) → void
Answers the next session start with a cursor with resync_required and reason instead of the catch-up.
override
holdDispatches() → void
Holds every dispatch until releaseDispatches, as a slow gateway delivery would.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
releaseDispatches() → void
Sends the held dispatch frames in order and delivers again.
override
revoke(String? deviceId) → void
Closes every connection of deviceId (every device when null) with 4012 and revokes their sessions.
override
sendStatsLive(JsonMap frame) → int
Sends frame (a StatsLiveFrame, for example a fixture of bothy_viz) as the ephemeral event stats.live to every live connection with a subscription, with the scope of each subscription (no sli for a space, 25 5.2); returns the number of connections reached. The fake builds no frames itself: the test decides when one arrives, so "no frame for viz.stale_after" is a test that sends none.
sentOn(int number) → List<GatewayFrameRecord>
The frames the server sent on connection number.
toString() → String
A string representation of this object.
inherited

Operators

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