Creating a node.js PEER application using WebRTC

So, I have a web application that generates large buffers of color information that I want to send to a node application running on another computer on my local network. Web sockets are not too fast for me. I tried using UDP and it seems that WebRTC is the only way to do this from the browser. The caveat seems to be that WebRTC is only PEER to PEER (browser to browser). I decided that I could use node webkit to emulate what was my other "PEER". In my node application, I could handle the β€œsignaling” and configure it in RTCPeerConnection for my web application. Therefore, I can send my data from my web application to my node application (local area network). In some context, I have one computer running my own lighting fixture management software, and I want to use a web-based application for controlling lights.

To minimize the question, how can I make RTCPeerConnection from a browser to a node webkit application?

Any help would be greatly appreciated.

Thanks!

-Jake

+8
source share
2 answers

Node-RTCPeerConnection is an attempt ( current WIP ) to create a specification-compatible RTCPeerConnection implementation for Node.js entirely in JavaScript without native C or C ++ code. This allows browser peers to communicate with peers (Node.js).

But you cannot use it for production yet.


In addition, we also have wrtc (node-webrtc), which provides its own module for NodeJS, which supports a subset of WebRTC-compliant features. In particular, the PeerConnection API and DataChannel.

Too many people have wrtc problems. Since he has to download a lot of source code and compile it only to find out that after some time it crashes on certain platforms. Unfortunately, it does not come with the pre-packaged packages described in this release.


You can use either the google implementation of webrtc or a later (from Ericsson) implementation called openWebrtc . OpenWebRTC developers are very proud to launch their implementation on various devices, such as raspberry pi and iOS devices.


Electronic-webrtc (which, in turn, uses electronic-built-in ) is best for me for better compatibility. He creates a hidden Electron process (which is based on Chromium, so WebRTC support is great!) And contacts this process to enable WebRTC in Node.js. This adds a lot of overhead.

It is intended for use with RTCDataChannels, therefore the MediaStream API is not supported.


Other sources:
https://github.com/webrtcftw/goals/issues/1

+10
source

Update 2019

Currently, the best and easiest way to solve this problem is to use the webrtc module. Check out the samples for inspiration. This module does what you were looking for, implemented using the N-API and using the Canvas module to create a new video from the client stream. Hope this helps those facing this problem in the future.

0
source

Source: https://habr.com/ru/post/1246197/


All Articles