function
diagnostics_channel.unsubscribe
name: string | symbol,
): boolean;
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);@param name
The channel name
@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