This function sends a custom event with a specified topic and payload to the swarm's bus service, allowing clients to broadcast messages
for other components to listen to. It is wrapped in beginContext for a clean execution environment and logs the operation if enabled.
The function enforces a restriction on reserved topic names (defined in DISALLOWED_EVENT_SOURCE_LIST), throwing an error if a reserved
topic is used. The event is structured as an ICustomEvent with the provided clientId, topicName as the source, and payload.
Type Parameters
T extends unknown = any
The type of the payload, defaulting to any if unspecified.
Parameters
clientId: string
The unique identifier of the client emitting the event.
topicName: string
The name of the event topic (must not be a reserved source).
Emits a custom event to the swarm bus service.
This function sends a custom event with a specified topic and payload to the swarm's bus service, allowing clients to broadcast messages for other components to listen to. It is wrapped in
beginContext
for a clean execution environment and logs the operation if enabled. The function enforces a restriction on reserved topic names (defined inDISALLOWED_EVENT_SOURCE_LIST
), throwing an error if a reserved topic is used. The event is structured as anICustomEvent
with the providedclientId
,topicName
as the source, andpayload
.