method
diagnostics_channel.Channel.unsubscribe
): void;
Remove a message handler previously registered to this channel with channel.subscribe(onMessage).
import diagnostics_channel from 'node:diagnostics_channel';
const channel = diagnostics_channel.channel('my-channel');
function onMessage(message, name) {
// Received data
}
channel.subscribe(onMessage);
channel.unsubscribe(onMessage);@param onMessage
The previous subscribed handler to remove
@returns
true if the handler was found, false otherwise.
Referenced types
type ChannelListener = (message: unknown, name: string | symbol) => void