publish

fun publish(message: Any?)(source)

Publish a message to any subscribers to the channel. This will trigger message handlers synchronously so they will execute within the same context.

import diagnostics_channel from 'node:diagnostics_channel';

const channel = diagnostics_channel.channel('my-channel');

channel.publish({
some: 'message',
});

Since

v15.1.0, v14.17.0

Parameters

message

The message to send to the channel subscribers