![](codearchitecture.png)
Description of the Code Architecture
-
Clients interacts with the server for url of the app and home page of the app is rendered.
-
Server is same for multiple clients.
-
Then Client requests the server for joining room.
-
Sever redirects the clients to unique roomId.
-
Once the room is joined event is emitted using socket.io
-
Socket.io handles the events and creates real time communication channel between client and server.
-
Then a peer object is created and request is sent to peerjs server for connecting to peer.
-
peerjs library is based on webrtc and uses stun servers for peer to peer connection.
-
But since NAT and firewall creates issue while sharing users media so turn servers need to be used for relaying the traffic.
-
That's how two people are finally able to connect using my app.