How do AppRTC work in WebRTC mechanism ?

In this article, we illustrate how AppRTC do work.

AppRTC is a WebRTC open source repo that implements two clients who can communicate with each other with webcam and voice. That works like a chatting room but only two persons in the room. When there have two clients in the room, they will exchange some messages for building a p2p connection and starting communication.

But it doesn’t the whole WebRTC main mechanism that is only data exchange and manages the connection process. So AppRTC is a sample system when the coder implements WebRTC, help them decrease the development time.

AppRTC Repo is here! WebRTC mechanism

Manipulate AppRTC First, one client joins a room and waiting for the other client to join. At once, there are two clients in the room, they can chat with each other.

The AppRTC Implement (not include p2p mechanism) We divided into two part to illustrate AppRTC work. The first client join room and the second client join room.

The first client join room:

  1. Get / for getting AppRTC home page.

  2. Post /join/:room_id for registry room id into AppRTC and getting a Client ID to registry Signal Server.

  3. Use Client ID to registry Signal Server (Collider Server)

    send /ws {cmd: "register", "roomid":"", “clientid”: ""}

  4. POST /message/:room_id/:client_id for storing p2p connection message into AppRTC Server.(About sdp、(ICE) candidate messages)

  5. Waiting another sdp and (ICE) Candidate message.

The second client join room:

  1. Get / for getting AppRTC home page.

  2. Post /join/:room_id for registry room id into AppRTC and getting a Client ID to registry Signal Server and first client p2p connection cache(sdp, (ICE candidate)

  3. According to cache generates a new p2p connection message and send it by WebSocket to the first client

  4. Two clients communicate with each other through p2p.

The Collider Server API

The Collider server has two functions. one is HTTP, the other one is WebSocket. The WebSocket API is for the client to communicate with each other like registry and send these actions. The HTTP API is for AppRTC server sync room status.

WebSocket API

HTTP API

Conclusion In the AppRTC demo application, it follows Broker Architecture to coordinate p2p message exchange. Though the key-point is not the sdp and (ICE) candidate message exchanged method, but it still important to manage the exchange process. So if you read AppRTC open source, this article can help you modify this project.

Last updated