Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WebRTC Data Channel server to clients UDP communication. Is it currently possible?

Is it possible to use WebRTC Data Channels on Node.js in a way that mimics the functionality of WebSockets except using UDP?

In essence I want to have a server running Node.js with which browser clients can establish a full duplex bi directional UDP connection via JavaScript.

My question is the same as this one from 8 months ago. I repost it because the only answer was :

Yes, in theory you should be able to to do this. However, you'll need a node module that supports WebRTC data channels, so that you can connect to it like any other peer. Unfortunately, scanning through the current modules, I don't see one that implements the data channel.

Any of you know of such a module ? In my search I found some node modules with the words "webrtc" and "datachannel", but they didn't look like what was needed, they looked like they were meant for specific needs.

like image 243
user3147646 Avatar asked Mar 15 '14 02:03

user3147646


2 Answers

This project is very active, and seem to undertake the mission of importing the entire WebRTC stack into node.js There's also this project but it looks pretty inactive.

Would love to know if that was satisfying and if you're doing such a project (as in the question) please link to github :)

like image 88
shacharz Avatar answered Sep 30 '22 11:09

shacharz


We have implemented the exact same thing: a server/client way of using WebRTC. Besides we also implemented data port multiplexing, so that server would only need to expose one data port for all rtcdata channels.

A quick summary of how it is achieved:

  • We implemented in nodejs, using wrtc library. But the same principal could be applied to other implementations.
  • The server exposes a control port, so that the client will exchange SDPs with the server for establishing their data channel.
  • To support data port multiplexing, At the server, we modify both peer's SDK, so that
    1. Client will always connect to the same server ip:data_port
    2. We implement a UDP data proxy inside the server, so that it can be the bridge between the server webrtc engine and the client.

The code is at: https://github.com/noia-network/webrtc-direct

like image 33
Miao ZhiCheng Avatar answered Sep 30 '22 11:09

Miao ZhiCheng