✍️
ZiXiang-Blog
  • Jerry Wang Blog
  • 使用 TorchServe 部署 Model
  • How do AppRTC work in WebRTC mechanism ?
  • [系統設計]- 容易產生設計盲點
  • Golang
    • [Golang] Goroutine Concurrency多執行緒淺談
    • [Golang]: 進階用法
    • Golang go mod 入門
    • [Golang] 讓 Goroutine Debug 變得更簡單
  • Security
    • HTTP Token 使用方式: Basic Token v.s Bearer Token
    • 從 RFC 規格書觀點解析 OAuth 2.0
    • 區塊鏈物聯網架構 解決哪些安全性議題?
  • Broker
    • [深入淺出MQTT]: v3.1.1與v5 的差異
    • Broker 到底是什麼?
  • patterns
    • Patterns for Organizing Domain Logic
    • Domain Model: 從無到有規劃新的服務
    • 淺談CQRS
    • Backend System in Microservice Architecture: Where Does data store?
    • Ambassador pattern with Shared Database Pattern
    • Microservice Pattern 犧牲了什麼?
  • K8s
    • 分散式系統: 現代軟體架構與設計考量
    • Kubernetes 超入門
    • Kubernetes 架構
    • K8s 在 DevOps 中的作用
  • Database
    • Relation Database Index Overview
    • Draft: RDBMS(MySQL) v.s NoSQL (Monogo)
    • [淺談]- How Do RDBMS Thread work ?
    • [淺談]-NoSQL資料庫怎麼選?
    • How do pick the database more correctly?
    • Draft: 關聯式資料庫需要知道的幾件事
  • HTTP
    • Overview The WebSocket Mechanism
Powered by GitBook
On this page

Was this helpful?

How do AppRTC work in WebRTC mechanism ?

In this article, we illustrate how AppRTC do work.

Previous使用 TorchServe 部署 ModelNext[系統設計]- 容易產生設計盲點

Last updated 4 years ago

Was this helpful?

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.

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

numbers

parameters

illustration

1

{cmd: "register", "roomid":"", "clientid": ""}

join room

2

{cmd: "send", "roomid":"", "clientid": "", "msg":"JSON string"}

send message to the other client

HTTP API

numbers

parameters

illustration

1

post /bye/:room_id:/:client_id

delete collider room status

Conclusion In the AppRTC demo application, it follows 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.

Broker Architecture
AppRTC Repo is here!
WebRTC mechanism