提交 b14a7a98 authored 作者: Iñaki Baz Castillo's avatar Iñaki Baz Castillo

Add Peer.getConsumerForSource() method.

上级 e17f7740
...@@ -111,6 +111,17 @@ class Peer extends EnhancedEventEmitter ...@@ -111,6 +111,17 @@ class Peer extends EnhancedEventEmitter
return Array.from(this._consumers.values()); return Array.from(this._consumers.values());
} }
/**
* Get the Consumer asasociated to the given source (Producer).
*
* @return {Consumer}
*/
getConsumerForSource(source)
{
return this.consumers
.find((consumer) => consumer.source === source);
}
/** /**
* Close the Peer. * Close the Peer.
* *
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论