Welcome to this lecture. Here we talk about how to implement the notification service and how to broadcast messages to many clients.

At the end of this lecture you know which options are available and which one is the most suitable for the file sharing system.

Server-Client communication

Our exploration commences with identifying a technique to curate a lasting bond between the server and client, particularly for disseminating file updates. The envisioned connection ought to be unidirectional, encompass a modest footprint, and possess the flexibility to scale efficiently. Through the utilization of prevalent technologies, we aspire to concoct a streamlined and dependable system.

Typically, there exist two cardinal methodologies to facilitate enduring server-client dialogue over a network: the pull mechanism and the push mechanism.

Pull

Section-Assets_-File-Sharing---Pull-Architecture.gif

When a client application needs to check for new information on the server, the simplest (though not always optimal) method is to initiate a request and inquire. This is the essence of a pull API.

This communication style leverages the familiar request-response model commonly seen in standard REST APIs. However, rather than issuing a single request to fetch data, the client sends periodic requests for updates. Upon receiving the request, the server verifies and processes it before responding appropriately.

While this method is straightforward and functional, it comes with challenges:

  1. There can be delays in relaying updates, contingent upon the intervals between successive requests.
  2. Even in the absence of updates, the server faces a constant influx of requests. This inefficiency can potentially hamper server performance or even overload it, leading to an unsatisfactory user experience.

For our current scenario, consistently polling the server isn't ideal.

Frequent pulls, such as every second, would be taxing on performance. Conversely, polling merely every 10 seconds might compromise our goal of rapid file synchronization, essential for smooth collaboration.

Thus, for minimal services, the pull approach could be adequate. However, for larger-scale applications, its scalability remains in question.

Push

Section-Assets_-File-Sharing---Push-Architecture.gif

A more effective method to notify clients about server-side changes is through push architectures.

In this setup, the client establishes a connection just once. When data is available, the server actively pushes it through the connection.

Let's explore various implementations of this approach.