java - Error on Delivery Message on Spring WebSocket using StompClient -


i'm trying send messages topic, problem when send message nothing happens... i'm using apache tomcat 7.0.53

update: 04/15: link test:

http://ec2-54-187-72-145.us-west-2.compute.amazonaws.com:8080/kupo

login: admin

password: admin

link access tomcat log:

http://ec2-54-187-72-145.us-west-2.compute.amazonaws.com:28778/

p.s: need checked combobox on sidebar start watch messages

github link: https://github.com/tiarebalbi/kupo

log:

debug - gwebsockethandlerdecorator - connection established, sockjs session id=_mqg8qer, uri=/kupo/application/807/_mqg8qer/websocket debug - stompdecoder               - decoded [payload byte[0]][headers=    {stompcommand=connect, nativeheaders={heart-beat=[10000,10000], accept-version=[1.1,1.0]},     simpmessagetype=connect, id=e79a615e-5522-a0f9-aecf-6ea5a54b3d9b, timestamp=1397013491497}] debug - stompencoder               - encoded stomp command=connected headers={user-name=[balbi], heart-beat=[0,0], version=[1.1]} debug - stompdecoder               - decoded [payload byte[0]][headers={stompcommand=subscribe, nativeheaders={id=[sub-0], destination=[/topic/greetings]}, simpmessagetype=subscribe, simpsubscriptionid=sub-0, simpdestination=/topic/greetings, id=42c2019d-96a0-95f0-29aa-2bcc62d6d721, timestamp=1397013491501}] 

code:

@service public class exampleserviceimpl implements applicationlistener<brokeravailabilityevent> {  private atomicboolean brokeravailable = new atomicboolean();  @autowired private messagesendingoperations<string> messagingtemplate;  @override public void onapplicationevent(brokeravailabilityevent event) {     this.brokeravailable.set(event.isbrokeravailable()); }  @scheduled(fixeddelay=3000) public void testing() {     if (this.brokeravailable.get()) {         this.messagingtemplate.convertandsend("/topic/greetings", "testing....");     } } 

javascript connect:

        var socket = new sockjs('/kupo/application'); // <!-- endpoint         var stompclient = stomp.over(socket);         stompclient.connect({}, function(frame) {              var username = frame.headers['user-name'];             console.log("user connected: " + username);              stompclient.subscribe("/topic/greetings", function(message) { // <-- topic want received message                 console.log("topic:",message);             });          } , function(error) {             console.log("stomp protocol error " + error);         }); 

browser console:

opening web socket... stomp.min.js:8 web socket opened... stomp.min.js:8 >>> connect accept-version:1.1,1.0 heart-beat:10000,10000  <<< connected user-name:balbi heart-beat:0,0 version:1.1  connected server undefined stomp.min.js:8 user connected: balbi  >>> subscribe id:sub-0 destination:/topic/greetings 

browser console

websocket context configuration:

@configuration @enablewebsocketmessagebroker public class websocketapplicationcontext extends abstractwebsocketmessagebrokerconfigurer {  @autowired private environment env;  @override public void registerstompendpoints(stompendpointregistry registry) {     if (env.acceptsprofiles("test.tomcat")) {         registry.addendpoint("/application")                 .sethandshakehandler(                         new defaulthandshakehandler(new tomcatrequestupgradestrategy()))                 .withsockjs();     } else {         registry.addendpoint("/application").withsockjs();     } }  @override public void configuremessagebroker(messagebrokerregistry registry) {     registry.enablesimplebroker("/queue/", "/topic/");     registry.setapplicationdestinationprefixes("/app"); } } 

when connecting application, managed send message topic javascript console , message in web page.

var socket = new sockjs('/kupo/application'); var stompclient = stomp.over(socket); stompclient.send('/topic/greetings',{},"hello"); 

and received:

<<< message subscription:sub-0 content-length:5 message-id:ts3oov6b-1 destination:/topic/greetings content-length:5  hello  

is scheduling task being called expected?

why you, in main configuration, importing configurations , still scanning configuration package? shouldn't 1 or other?


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -