publishEphemeral method
Publishes an ephemeral event (no seq, never in the log) to the eventHooks.
audience makes it personal; devices names the devices of audience whose live
connections get it (the gateway sends an ephemeral event only with both).
Implementation
FakeEvent publishEphemeral(
String type, {
required JsonMap resource,
required JsonMap payload,
JsonMap scope = const {},
String? audience,
Set<String>? devices,
}) {
final event = FakeEvent(
_copy({
'id': nextId(),
'type': type,
'schema_version': 1,
'occurred_at': stamp(),
'scope': scope,
'resource': resource,
if (audience != null) 'audience': 'self',
'payload': payload,
}),
audience: audience,
devices: devices == null ? null : Set.unmodifiable(devices),
);
for (final hook in List.of(eventHooks)) {
hook(event);
}
return event;
}