RTCPeerConnection | WebSocket Server

The TsgcRTCPeerConnection client requires a WebSocket Server for signaling. The client makes use of the WebSocket protocol to exchange the SDP of the peers and the candidates (IPs and Ports), which will allow to communicate between peers.

 

To configure a WebSocket server you can use any of the WebSocket servers availables in the sgcWebSockets library and attach a TsgcWSPServer_RTCPeerConnection which is the sub-protocol used by the RTCPeerConnection.

 


oServer := TsgcWebSocketServer.Create(nil);
oProtocol := TsgcWSPServer_RTCPeerConnection.Create(nil);
oProtocol.Server := oServer;
oServer.Port := 8080;
oServer.Active := True;

 

Every time a new websocket client connects to the websocket server, the server will check if there is any other peer listening on the same channel and will forward the data accordingly.