subscribe - How can I get different response data to each person using WebSocket -
i'm planing use spring websocket using below url.
https://github.com/rwinch/spring-websocket-portfolio/tree/security
but, i'm worried how different response data each person.
self.connect = function() { stompclient.connect({}, function(frame) { console.log('connected ' + frame); self.username(frame.headers['user-name']); stompclient.subscribe("/topic/price.stock.*", function(message) { self.portfolio().processquote(json.parse(message.body)); }); }, function(error) { self.pushnotification(error.headers.message) console.log("stomp protocol error " + error); }); }
it's working, users getting same data.
@service public class quoteservice implements applicationlistener<brokeravailabilityevent> { ................ @scheduled(fixeddelay=2000) public void sendquotes() { (quote quote : this.quotegenerator.generatequotes()) { if (logger.istraceenabled()) { logger.trace("sending quote " + quote); } if (this.brokeravailable.get()) { this.messagingtemplate.convertandsend("/topic/price.stock." + quote.getticker(), quote); } } } ................. }
this quoteservice
pushes array data user using messagingtemplate.convertandsend
.
so, wonder if each persons see each views, how push different data them. possible?
Comments
Post a Comment