Implementing a websocket queue for a stateless web application

I would like to hear your opinion on what would be the best option for implementing the websocket queue using the Spring protocol and STOMP when there is no user session (a stand-alone, calm web application).

Based on this explanation: https://stackoverflow.com/a/3166161/ I know that Spring will use queuewhen we use the method simpMessagingTemplate.convertAndSendToUser(...)and pass in the username associated with the session identifier. Otherwise, it will use topicwhere all signed clients will eventually read the same message returned from the server.

In my case, I have a RESTful application with part of the Angular interface. I want to implement a progress bar on the user interface side. Initially, the user interface sends a message to the server with a given ID, which has been defined previously, an ex: {id: 20}.

Then the user interface should listen for changes in the returned model for a specific identifier and calculate the progress of internal processing. The return message may look like this:{id: 20, timeLeft: 30, totalTime: 60}

So, for every Angular application that will be subscribed to the websocket channel on the server, it should give different results.

Since I do not have a session in the application and you must implement the queue on the web server on the server, do you know other solutions using Spring and the STOMP protocol, different from the one I recently came up with:

Spring: simpMessagingTemplate.convertAndSend("/ui/progress/"+id, ...)

UI ng-stomp: $stomp.subscribe("/ui/progress/"+id, function(...))

, "" , . .

+4

All Articles