Push technology enables applications to deliver information to users without them having to explicitly request it. Here’s how it works:
Core Mechanism
At the heart of push technology is a system that actively delivers information, instead of the traditional pull system where a client requests data from a server. This system involves several key components:
- The Push Service: This service acts as the intermediary between the application server and the user's browser.
- According to the reference, a push service receives a network request, validates it and delivers a push message to the appropriate browser.
- It’s important to note that each browser can use any push service they want, it's something developers have no control over.
- The Application Server: This server is responsible for generating the push message and sending it to the chosen push service.
- The User's Browser (or Device): The browser receives the message from the push service and displays it to the user.
Step-by-Step Process
Here is a breakdown of how push messaging typically works:
- Subscription: A user grants permission for a specific website or application to send push notifications. This usually involves the user explicitly clicking a button or giving consent through an interface.
- Registration: When a user subscribes, the browser generates an endpoint URL. This URL acts like an address for the specific user's browser through which push messages are sent. The application server needs to store this endpoint URL.
- Message Trigger: When the application server has a message to send, it sends a request to the push service using the registered endpoint URL.
- Push Message Delivery: The push service validates the request and sends a push message. If the browser is offline, the message is queued until the browser comes online.
- Display Notification: When the browser receives the push message it displays a notification to the user.
- User Interaction: The user can interact with the notification (e.g., click to open the app or website).
Key Considerations
- Browser Choice: The reference highlights that each browser can use any push service they want, it's something developers have no control over. This means the developer does not specify the push service being used. Instead, the browser handles this process, choosing a service compatible with its platform.
- Offline Handling: The reference clearly states that if a user's browser is offline when a message is sent, the push service queues the message until the browser comes back online, thus ensuring no important notifications are missed.
- Privacy and Permissions: User consent is crucial. Users have the ability to allow or deny push notifications for specific websites or apps.
- Types of Push Messages: Push messages can vary from simple text alerts to more complex notifications with images, buttons, and actions.
Summary
Push technology allows servers to send notifications directly to users’ browsers via a push service. This process happens when a browser subscribes to receive push notifications from a specific application. The push service manages the delivery of these messages and ensures that they are received even if the browser was previously offline.