Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Pubsub Datachannel #16

Merged
merged 11 commits into from
Aug 7, 2024
Merged

Conversation

luongngocminh
Copy link
Contributor

@luongngocminh luongngocminh commented Jul 30, 2024

Pubsub Datachannel implementation following this pr: 8xFF/atm0s-media-server#398
User can test the msg channel feature in the 2 of the echo_fast examples: image

Copy link

vercel bot commented Jul 30, 2024

@luongngocminh is attempting to deploy a commit to the 8xff Team on Vercel.

A member of the Team first needs to authorize it.

apps/web/app/react_samples/echo_fast/content.tsx Outdated Show resolved Hide resolved
@@ -116,6 +121,109 @@ export class Datachannel extends EventEmitter {
}
}

public async requestStartPublishChannel(req: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should leave all of details to msg_channel. I think in data.ts we only implement abstract like: requestMsgChannel

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't data.ts purpose is to communicate to the server through implemented apis? msg_channel feature is depended on data.ts, so shouldn't the abstraction be on the msg_channel side? Developer should be able call data.ts in anyway they prefered without any abstraction.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@luongngocminh No, data.ts is an abstraction for contacting servers. We don't need to update data.ts each time the protocol of Sender, Receiver, or MessageChannel ... changes.

Copy link

vercel bot commented Aug 3, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
atm0s-media-sdk-samples ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 3, 2024 10:55am

) {
const ctx = useContext(Atm0sMediaContext);
const [channel, setChannel] = useState<RoomMessageChannel | null>(null);
useEffect(() => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need a function same with ctx.getOrCreatePublisher. Without it we will leak datachannel each time useEffect re-run

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of keeping a registry of msg channels in the react lib like the publishers, I've updated the core sdk to natively track the channels creation

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@luongngocminh It look good. Can you create same mechanism with publishers after this PR is merged?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@giangndm do you want to move the publisher class into the core sdk? Because now it's only available in the react hooks side

Copy link
Contributor

@giangndm giangndm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will merge it now

@giangndm giangndm merged commit 0d9fc13 into 8xFF:main Aug 7, 2024
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants