once() #
Available since 2.9.0
Listens to an event emitted with BackendCluster.broadcast.
The registered listener will be called exactly once, after which it will be removed from the listeners list.
This method can only be used once the application is started.
once (event: string, listener: ClusterEventHandler): Promise<void>| Argument | Type | Description |
|---|---|---|
event | string | Event name |
listener | ClusterEventHandler | Listener function. Called exactly once. |
Usage #
await app.cluster.once('some:event', payload => {
// ...listener code...
});