java - Spring user destinations -
i have spring boot application have publish user defined destination channels such:
@autowired private simpmessagingtemplate template;  public void send() {    //..    string uniqueid = "123";    this.template.convertandsendtouser(uniqueid, "/event", "hello"); } then stomp on sockjs client can subscribe , receive message. suppose have stomp endpoint registered in spring application called "/data"
var ws = new sockjs("/data"); var client = stomp.over(ws); var connect_fallback = function() {    client.subscribe("/user/123/event", sub_callback); };  var sub_callback = function(msg) {     alert(msg); };  client.connect('','', connect_callback); actually there more 1 user client subscribing same distinct user destination, each publish/subscribe channel not 1 one , doing way since spring's concept of "/topic" have defined programmatically , "/queues" can consumed 1 user. how know when user destination no longer has subscribers? , how delete user destination?
@sendtouser('/queue/dest') public string send() {    //..    string uniqueid = "123";    return "hello"; } on client subscribe '/user/queue/dest'
Comments
Post a Comment