unsubscribe
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);
Content copied to clipboard
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