I use the spring / stomp / websocket structure to asynchronously notify message users. I have done this successfully. However, I would get an ACK from the client so that some server-side action could happen when this is done.
A stream is approximately like a stream:
- The service notifies a specific user of the decision and updates the record in the database with the status = "notification"
- The client receives the message (using stompClient.subscribe (...))
- The client confirms that the message has been received.
The service "knows" that this message is acknowledged and updates the status to "ACK" in the database.
stompClient.connect({login:'guest', passcode:'guest'}, function(frame) { setConnected(true); **var headers = {ack: 'client'};** ... stompClient.subscribe('/user/guest/response',function(notification) {
A message has been sent to the service:
this.messagingTemplate.convertAndSendToUser(user, "/response",msg, map);
Is there a way to handle the client ACK on the server side? Alternatively I tried to do
stompClient.send("/app/response/ack/"+messageId);
on the client, in a method that processes the subscription, but in vain.
Can someone please tell me what is the standard way to process confirmations? I struggled with this for a couple of days, and any thoughts would be very helpful.
Thanks!
source share