From 32e6415b4e9c9e7a374d7c7449d604449bc09a93 Mon Sep 17 00:00:00 2001 From: Hussein El Feky Date: Mon, 19 Feb 2024 01:38:09 +0200 Subject: [PATCH] Add WebRTC as a real-time notification method In my opinion, it's important to also mention WebRTC as a more recommended approach over Web-Sockets when it comes to live streaming and video/audio calls, and explain that WebRTC works over UDP while Web-Sockets work over TCP. --- README.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e03297b..707f575 100644 --- a/README.md +++ b/README.md @@ -188,12 +188,20 @@ Allows the client to stream events over an HTTP connection without polling. - cons: - keeps a persistent connection. - **Web-Sockets**: -Provide a bi-directional communication between client and server. +Provide a bi-directional communication between client and server, and work over TCP. - pros: - can transmit both binary and text data. - cons: - more complex to set-up compared to Polling/SSE. - keeps a persistent connection. +- **WebRTC**: +Provides a peer-to-peer connection, and works over UDP. + - pros: + - best used for live streaming and video/audio calls. + - favors reduced network latency over quality unlike Web-Sockets. + - cons: + - packets may be lost when internet is slow or unstable. + - keeps a persistent connection. The interviewer would expect you to **pick a concrete approach** most suitable for the design task at hand. One possible solution for the "Design Twitter Feed" question could be using a combination of SSE (a primary channel of receiving real-time updates on "likes") with Push Notifications (sent if the client does not have an active connection to the backend).