Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Server as WebRTC data channel peer

Tags:

udp

webrtc

Are there currently solutions where your server can act as the peer of a WebRTC connection?

The reason I am interested in WebRTC is not the peer-to-peer part of it, but because it enables you to use UDP. You could let players participate in a fast-paced game like Quake without needing any plugins.

It seems that essentially this same question was asked before, but surely things must now be quite different as 2 years have passed.

like image 453
Bemmu Avatar asked Feb 08 '23 00:02

Bemmu


2 Answers

Yes, it is possible to deploy your WebRTC peer code on server. But since you need to run it on server, it's essentially different from how you run the WebRTC code within the browser - i.e. through a Java Script.

For server based WebRTC peer, you would need to use the WebRTC native code available on platforms - Windows, Mac OS X, Linux, Android and iOS. You can get the WebRTC native code from - https://webrtc.org/native-code/development/

Follow the instructions here to download and build the environment. Sample applications are also present in the repository at the locations - src/webrtc/examples and src/talk/examples

In summary you have use the WebRTC source code that is embedded in the browser in your application code and call the relevant methods / API for the WebRTC functionality.

like image 136
Milind Jalwadi Avatar answered Mar 02 '23 17:03

Milind Jalwadi


I have answered similar question at: WebRTC Data Channel server to clients UDP communication. Is it currently possible?

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.

like image 29
Miao ZhiCheng Avatar answered Mar 02 '23 17:03

Miao ZhiCheng