Alessandro De Cristofaro’s Post

View profile for Alessandro De Cristofaro, graphic

EVM Blockchain - Full Stack Developer

One of the exciting new features I'm developing for my P2P Chat is a Live Streaming system that leverages a tree-based distribution algorithm. A notable challenge in P2P connections is the limited bandwidth offered by home internet services, which understandably falls short of the broadcasting server capabilities of platforms like Twitch or YouTube. This limitation greatly restricts the number of concurrent connections an individual streamer can sustain during a live stream. The ideal solution involves creating a tree structure where the originating streamer sends the video signal to no more than four recipients. These recipients, in turn, relay the video signal to subsequent users who connect. Let's explore how this works specifically when the main streamer has fewer than four active concurrent connections: - A client wishing to connect sends a connection request to the main streamer. - The main streamer initiates a P2P call to the client, conveying the media stream. - Since the call originates from the streamer, the client accepts the incoming stream. Conversely, if the main streamer already has four active concurrent connections: - A client wishing to connect sends a connection request to the main streamer. - The main streamer selects an already connected client that is receiving the media stream and communicates the client ID to the waiting client. - The main streamer sends a request to the active client, instructing it to call the waiting client. - The waiting client verifies if the incoming stream is sent by the client ID previously communicated. If confirmed, it accept the call and begin streaming the content (becoming a free relay client). This method thus allows for the establishment of a secure connection between two clients within a P2P network in four simple steps, while initially communicating with the source streamer. Indeed, the handshake phase ensures the receiving client will only accept calls from clients recognized by the originating streamer. #svelte #sveltejs #peerjs #p2p #distributed #network #stream #js

  • No alternative text description for this image

To view or add a comment, sign in

Explore topics