Skip to main content

unsubscribe

method Channel.prototype.unsubscribe
Jump to headingChannel.prototype.unsubscribe(onMessage: ChannelListener): void
Deprecated

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);

Parameters Jump to heading

The previous subscribed handler to remove

Return Type Jump to heading

void

true if the handler was found, false otherwise.

Back to top