TsgcRTCPeerConnection

The TsgcRTCPeerConnection is a client component that allows you to connect peers using P2P through UDP.

Introduction

[*Currently this component is in development]

 

The TsgcRTCPeerConnection is a client component that allows you to connect peers using P2P through UDP. The flow can be broken into 4 steps:

 

 

To implement those steps, the client makes use of the following protocols:

 

 

Signaling

When the client starts it has no idea who it is going to communicate with or what it is going to communicate about. Signaling uses the SDP (Session Description Protocol) which contains details like:

 

 

The Signaling makes use of the WebSocket protocol to exchange the data, it works through a subprotocol and it's implemented in the TsgcWSPServer_RTCPeerConnection component on server side.

The TsgcRTCPeerConnection already creates internally a websocket client with TsgcWSPClient_RTCPeerConnection attached.

 

To obtain the IPs and Ports, the client makes use of the STUN/TURN protocols to obtain this information. So a STUN/TURN server is required too.

 

Links:

 

Connecting

Once the 2 peers know the candidates and SDPs, the client uses another standard protocol called ICE.

 

ICE (Interactive Connection Establishment) allows the establishment of a connection between 2 peers. The peers can be in the same network or behind a NAT... ICE is a solution to establishing a direct connection without a central server. If the connection cannot be P2P, ICE will use TURN to relay the data using a TURN server.

 

Once ICE finds a valid candidate that can connect between the two peers, the next step is to encrypt the communication.

 

Links:

 

Securing

After the peers have connected, the communication must be secure. This is done using DTLS, which is a cryptographic protocol used to secure communication over UDP.

 

Once the DTLS handshake has been successfully processed, another protocol is used, SRTP (Secure Real-Time Transport Protocol), currently SRTP is not implemented.

 

Links:

 

Communicating

Once the 2 peers are using a secure protocol, the communication is done using 2 protocols:

 

 

Currently these protocols are not implemented, but you can send/receive data using DTLS over UDP.

 

Links:

 

Reference