function unsubscribe
unsubscribe(name: string | symbol,onMessage: ChannelListener,): booleanDeprecated
Remove a message handler previously registered to this channel with 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);
onMessage: ChannelListenerThe previous subscribed handler to remove
booleantrue if the handler was found, false otherwise.