Ozeki Chat Administrator Training


Lecture 2.4 - Push notifications

In this article you’ll learn what push notifications are, how they function within the Ozeki Chat system, and the steps needed to configure and manage them for various client types. The article begins with a foundational overview of push notifications, followed by a detailed look at the mechanisms behind message delivery. We’ll then break down the setup process for Windows, Android, iPhone, and Browser clients, providing you with the knowledge to effectively manage notification settings across these platforms.

What are push notifications?

Push notifications are server-initiated messages that appear on a user’s device, such as a smartphone, tablet, or computer, to notify them of new events or updates, even if the relevant app isn’t open. Designed to deliver timely information directly to users, these notifications can include alerts for incoming messages, updates, or reminders.

How do push notifications work?

When a chat user sends a message, the Ozeki Chat Server initiates the push notification process and adapts its delivery methods based on the target device type. For browser clients and Windows-based applications, notifications are sent via WebSocket connections secured by SSL. This approach creates a continuous, real-time communication channel that allows messages to be delivered instantly.

For mobile devices, such as smartphones and tablets, the process involves notification services provided by Google and Apple. After receiving a message, the Ozeki Chat Server sends the notification data as an HTTPS POST request in JSON format to the relevant service. Android devices, including phones and tablets, receive notifications through the Google Firebase Push Notification Service. Once the Ozeki Chat Server dispatches the notification request, Firebase processes it and forwards the message to the Android device’s notification system, where it appears as an alert.

For Apple devices, including iPhones, iPads, and MacBooks, the Apple Push Notification Service (APNs) manages the notification delivery. In this case, the Ozeki Chat Server sends the notification payload to APNs, which then routes the message to the device's notification center. This setup allows the system to deliver notifications across multiple device ecosystems, providing compatibility for both Android and iOS platforms.

push notification delivery
Figure 1 - Push notification delivery

The process begins when both Alice and Bob’s devices, an Android phone and an iPhone respectively, come online and register with the Ozeki Chat Server. The server assigns each device a unique identifier — for instance, Alice’s device is labeled as dev123 and Bob’s as dev456. Once online, Alice’s status is updated on the server, followed by Bob’s, indicating that both users are connected.

After both devices are registered and users are marked as online, Alice initiates a new chat by sending a message to Bob. The Ozeki Chat Server receives this message and triggers a push notification to Bob’s device. The notification appears with the content “1 message from Alice,” alerting Bob to the incoming message.

Following the notification, Bob’s device requests the conversation data from the server. The server responds by downloading the conversation thread, which includes Alice’s message, "hello." This message is then displayed on Bob’s device, allowing him to view the conversation.

Once Bob has accessed the message, the server sends a “clean” push notification, effectively resetting the notification badge on Bob’s device to indicate that there are no unread messages remaining. The sequence concludes with Bob’s device acknowledging the message, completing the interaction and ensuring that both parties have successfully communicated through the Ozeki Chat system.

uml time sequence diagram
Figure 2 - UML time-sequence-diagram

How to setup and manage push notifications for Windows Clients

For Windows clients, push notifications are handled by the Ozeki Chat Server using the UDP protocol. When a new chat message is received, the server sends notifications directly to the Windows application over UDP.

To set up push notifications on a Windows client, you need to ensure that the application is configured to receive UDP messages. Once configured, the Windows client can stay connected to the Ozeki Chat Server, instantly receiving notifications as they are sent. Managing notifications on Windows involves adjusting the application’s notification settings to control how alerts are displayed and whether they include sound or other prompts.

How to setup and manage push notifications for Android Clients

For Android clients, push notifications are managed through the Google Firebase Push Notification Service. When a message is received, the Ozeki Chat Server sends the notification data as an HTTPS POST request in JSON format to Firebase. Firebase then relays the notification to the Android device, displaying an alert on the user’s phone or tablet.

To set up notifications on an Android device, the app must be registered with Google Firebase and configured to handle incoming notifications. The application can be customized to control how these alerts are presented, such as through vibration, sound, or visual notifications. Managing push notifications on Android involves setting notification preferences in the app’s settings, where users can choose how and when they receive alerts.

How to setup and manage push notifications for iPhone Clients

iPhone clients receive push notifications through the Apple Push Notification Service (APNs). When a new chat message arrives, the Ozeki Chat Server sends the notification in JSON format to APNs, which then forwards it to the iPhone, appearing as a notification on the screen.

Setting up push notifications on an iPhone involves registering the app with APNs and configuring it to accept notifications. Users can manage how these notifications appear on their device by adjusting settings for sounds, badges, and alerts through the iPhone’s notification settings. Customization options allow users to specify when and how they receive notifications, ensuring they receive updates in a way that suits their preferences.

How to setup and manage push notifications for Browser Clients

Browser clients receive notifications from the Ozeki Chat Server via WebSocket connections secured by SSL. When a message is sent, the server transmits the notification over an SSL-encrypted WebSocket, creating a persistent connection that allows real-time delivery of notifications directly in the browser.

To set up push notifications in a browser, users must allow the application to send notifications, usually through a permissions prompt in the browser. Once permissions are granted, the browser client will display notifications even if the user is not actively browsing the application. Notification management for browser clients involves adjusting settings in the browser itself, where users can control whether they receive alerts and how they are presented on the screen.

More information