How to send text message browser to browser in webrtc?

I want to send text messages directly to the browser. So far, I only see demonstrations of audio / video programs on the Internet. These are my doubts:

  • Can't we solve this using the PeerConnection API?
  • Or does this require a new DataChannel API?
  • If so, in which browser / browsers are the dataChannel APIs implemented?

Thanks in advance for any help ..

+7
source share
4 answers

The answer to your question: Yes - you need to use the DataChannel API

Its not a cross browser, since it still implements it - I would probably use socket.io with node atm for a cross browser application.

Once the datachannel is complete, it will be AWESOME! :)

+4
source

You need to use the DataChannel API part of PeerConnection. This will work in Firefox 18 and onward and will come to Chrome soon.

A good starting point for understanding how to do this is https://hacks.mozilla.org/2012/11/progress-update-on-webrtc-for-firefox-on-desktop/ and the latest draft specification at http: / /dev.w3.org/2011/webrtc/editor/webrtc.html !

+3
source

There are some JavaScript libraries for sending text data using the WebRTC data feed API: PeerJS , webRTC.io , DataChannel.io , BoneValue ... (add more if you know)

+3
source

If you are only concerned with texting, why not use the WebSocket API, which has a much wider range of support?

0
source

All Articles