From sgcWebSockets 2022.8.0 a new component has been added to the sgcWebSockets library, the TsgcRTCPeerConnection.
The TsgcRTCPeerConnection is a client component that allows to connect peers using P2P through UDP. The flow can be break into 4 steps:When the client starts it has no idea who is going to communicate with and what they are 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:
Once the 2 peers now 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 can not be P2P, ICE will use TURN to relay the data using a TURN server.
Once ICE finds a valid candidate that can connect between 2 peers, then the next step is encrypt the communication
Links:
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:
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.
When you subscribe to the blog, we will send you an e-mail when there are new updates on the site so you wouldn't miss them.