8xFF / atm0s-media-server

Decentralized, Global-Scale Media Server written in Rust (WebRTC/Whip/Whep/Rtmp/Sip)
https://8xff.github.io/media-docs/
MIT License
211 stars 17 forks source link

Feat: Virtual DataChannel #327

Closed luongngocminh closed 4 weeks ago

luongngocminh commented 1 month ago

Pull Request

Description

Added a virtual datachannel for bi-direction communication between the users in a room. This datachannel is not the same with the WebRTC Datachannel, but it will use the WebRTC Channel to transports the pubsub style messages. A virtual datachannel can be created dynamically via Room Request through the SDK. A Room can have multiple virtual channels.

Checklist

codecov[bot] commented 1 month ago

Codecov Report

Attention: Patch coverage is 70.19231% with 124 lines in your changes missing coverage. Please review.

Project coverage is 44.65%. Comparing base (c459b13) to head (642b9f1).

Files Patch % Lines
packages/transport_webrtc/src/transport/webrtc.rs 0.00% 49 Missing :warning:
packages/media_core/src/endpoint/internal.rs 0.00% 25 Missing :warning:
...ackages/media_core/src/cluster/room/datachannel.rs 91.12% 19 Missing :warning:
packages/media_core/src/cluster/room.rs 31.81% 15 Missing :warning:
packages/protocol/src/protobuf/session.rs 0.00% 7 Missing :warning:
...dia_core/src/cluster/room/datachannel/publisher.rs 80.76% 5 Missing :warning:
...ia_core/src/cluster/room/datachannel/subscriber.rs 97.72% 1 Missing :warning:
packages/protocol/src/datachannel.rs 87.50% 1 Missing :warning:
packages/transport_webrtc/src/transport/whep.rs 0.00% 1 Missing :warning:
packages/transport_webrtc/src/transport/whip.rs 0.00% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #327 +/- ## ========================================== + Coverage 43.89% 44.65% +0.76% ========================================== Files 117 121 +4 Lines 12984 13384 +400 ========================================== + Hits 5699 5977 +278 - Misses 7285 7407 +122 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

giangndm commented 1 month ago

@luongngocminh can you update the changes in each comments?

luongngocminh commented 1 month ago

@luongngocminh can you update the changes in each comments?

Can you check the changes again I have already updated it

jibon57 commented 1 month ago

@luongngocminh nice! So, this could be a replacement of traditional websocket protocol? But how can it handle if subscriber disconnected & later connected again? Will they loose all those messages during disconnected time? Or server will store those & later deliver?

luongngocminh commented 1 month ago

@jibon57 The thought behind this feature is that it's a datachannel, not a message queue or a simple kind of way to do chat applications. It's basically a data delivering passage way, for data to travel around in realtime in a pub/sub manner. So as a developer, you can use these feature APIs to build your own implementation.