| 1 |
import { registry } from "@web/core/registry"; |
| 2 |
import { PeerToPeer } from "@mail/discuss/call/common/peer_to_peer"; |
| 3 |
|
| 4 |
export const discussP2P = { |
| 5 |
dependencies: ["bus_service"], |
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
start(env, services) { |
| 11 |
const p2p = new PeerToPeer({ |
| 12 |
logLevel: env.debug ? "info" : undefined, |
| 13 |
notificationRoute: "/mail/rtc/session/notify_call_members", |
| 14 |
}); |
| 15 |
services["bus_service"].subscribe( |
| 16 |
"discuss.channel.rtc.session/peer_notification", |
| 17 |
({ sender, notifications }) => { |
| 18 |
for (const content of notifications) { |
| 19 |
p2p.handleNotification(sender, content); |
| 20 |
} |
| 21 |
} |
| 22 |
); |
| 23 |
return p2p; |
| 24 |
}, |
| 25 |
}; |
| 26 |
|
| 27 |
registry.category("services").add("discuss.p2p", discussP2P); |