From 1ddbae2d76db5cfdf1609bb33ea6597425e38faf Mon Sep 17 00:00:00 2001 From: simon-id Date: Tue, 19 Oct 2021 12:01:41 +0200 Subject: [PATCH] lib: add unsubscribe method to non-active DC channels MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/40433 Reviewed-By: Vladimir de Turckheim Reviewed-By: Stephen Belanger Reviewed-By: Gerhard Stöbich Reviewed-By: Michael Dawson Reviewed-By: Bryan English Reviewed-By: Zijian Liu --- doc/api/diagnostics_channel.md | 2 +- lib/diagnostics_channel.js | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/doc/api/diagnostics_channel.md b/doc/api/diagnostics_channel.md index 52a9ac9808414a..47df6a42994257 100644 --- a/doc/api/diagnostics_channel.md +++ b/doc/api/diagnostics_channel.md @@ -267,7 +267,7 @@ added: changes: - version: REPLACEME pr-url: https://github.com/nodejs/node/pull/40433 - description: Added return value. + description: Added return value. Added to channels without subscribers. --> * `onMessage` {Function} The previous subscribed handler to remove diff --git a/lib/diagnostics_channel.js b/lib/diagnostics_channel.js index 813cda5bb3e83a..c85a9532b4d372 100644 --- a/lib/diagnostics_channel.js +++ b/lib/diagnostics_channel.js @@ -81,6 +81,10 @@ class Channel { this.subscribe(subscription); } + unsubscribe() { + return false; + } + get hasSubscribers() { return false; }