How to ensure reliable message delivery through websockets?

I am developing a simple server, the main task of which is to push notifications to users, like a typical Push Notification Server . I used java websockets to push notifications to users through a websocket session. In development, I have a list of some requirements in which reliable message delivery is one of the requirements.

I click on a notification to a specific user as shown below,

 session.getBasicRemote().sendObject(notification); 

but the above method returns void , so I can’t conclude if the notification is sent to the other end or not. One option was that the intended user would send feedback to my server for the same notification, and I mark the same notification that was delivered successfully. But this can lead to increased network traffic.

Is there a standard way to ensure that a notification is delivered successfully when sent through a websocket session

+2
java websocket
source share
1 answer

The websockets specification is really low and does not provide confirmation for sending messages. You must either implement this yourself, or as an application-level protocol, or use an existing protocol on top of web maps.

Stomp is a popular protocol that defines an "ACK" response for consumed messages: Stomp Specification

+3
source share

All Articles