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

Support binary payload in RTCDataChannel #24

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

js-seo
Copy link

@js-seo js-seo commented Jan 5, 2022

  • Fix sending binary data a6eb5e3
    • data.buffer which was at 157 line in RTCDataChannel.js before this change was becoming {} when it gets to the WKWebViewRTC.swift through the bridge. So data was not being sent as expected.
    • I encoded it to string before passing, and then decoded afterwards.
  • Fix receiving binary data 5afeb61
    • Encode and decode received data just like the sent data.
    • data field of the first argument(event) of RTCDataChannel.prototype.onmessage is now ArrayBuffer following the native browser API, other than { Type: 'ArrayBuffer', Data: string }

@hthetiot
Copy link
Contributor

hthetiot commented Jan 6, 2022

Interesting PR, I may back port this feature on https://github.com/cordova-rtc/cordova-plugin-iosrtc

@noahmehl
Copy link
Contributor

@js-seo WOW! Thanks so much for contributing this! We will review asap!

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.

3 participants