unsubscribe

external fun unsubscribe(name: String, onMessage: ChannelListener): Boolean(source)
external fun unsubscribe(name: Symbol, onMessage: ChannelListener): Boolean(source)

Remove a message handler previously registered to this channel with {@link subscribe}.

import diagnostics_channel from 'node:diagnostics_channel';

function onMessage(message, name) {
// Received data
}

diagnostics_channel.subscribe('my-channel', onMessage);

diagnostics_channel.unsubscribe('my-channel', onMessage);

Since

v18.7.0, v16.17.0

Return

true if the handler was found, false otherwise.

Parameters

name

The channel name

onMessage

The previous subscribed handler to remove