This repo contains a simple WebRTC demo that uses a Janus server to play back a video stream to a connected client.
There are three main components in this demo:
- The Janus server, which is the actual Janus server. It implements the WebRTC stack (including the signalling server).
- The Janus Node driver, which is a NodeJS server that implements application-level logic on top of the Janus server, acting as a middleware between a client and the Janus server.
- The WebRTC client, which is a simple WebRTC client written in React.
The way it works is:
- The Janode server connects to the Janus server using a WebSocket.
- The client connects to the Janode server using another WebSocket.
- The client sends a
startmessage, to which the Janode server responds with areadymessage. - The client sends an
offermessage that contains an SDP offer. The Janode server forwards this message to the Janus server, which returns an SDP answer, that is then sent back to the client as ananswermessage. - The client sends one
tricklemessage for each ICE candidate, and the Janode server forwards them to the Janus server. - Once all ICE candidates have been sent, the client sends a
trickle-completemessage. - At that point, the client and the Janus server are connected and exchanging video streams through WebRTC.
See this Notion page if any of these concepts are unfamiliar to you.