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
htuof 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
socketafter the upgrade and sendshello. -
close(
) → Future< void> -
Closes every connection with
1001and stops the timers. -
closeAll(
int code, String? reason) → void -
Closes every open gateway connection with
codeandreason.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
dispatchframe twice.override -
endStatsSubscriptions(
String principalId, {String code = 'forbidden'}) → void -
Ends the
stats.livesubscription of every connection ofprincipalIdwith oneerror {op: stats.subscribe}withcode, as the server does whenstats.readis lost (25 5.1 item 3). -
forceResync(
String reason) → void -
Answers the next session start with a cursor with
resync_requiredandreasoninstead of the catch-up.override -
holdDispatches(
) → void -
Holds every
dispatchuntil 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
dispatchframes in order and delivers again.override -
revoke(
String? deviceId) → void -
Closes every connection of
deviceId(every device when null) with4012and revokes their sessions.override -
sendStatsLive(
JsonMap frame) → int -
Sends
frame(aStatsLiveFrame, for example a fixture ofbothy_viz) as the ephemeral eventstats.liveto every live connection with a subscription, with the scope of each subscription (noslifor 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 forviz.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