I get a status 200 when connecting to the websocket, but it is an error?

Please check http://procbits.com/connecting-to-a-sockjs-server-from-native-html5-websocket! After you append /websocket (to your URL), it will give you the error Failed to parse Origin header value [null] 😉 , which then will in turn lead you to that link. You’ll have to add .setAllowedOrigins(“*”) to your addHandler() method, and then it could finally work!

Spring WebSocket @SendToSession: send message to specific session

No need to create specific destinations, it’s already done out of the box as of Spring 4.1 (see SPR-11309). Given users subscribe to a /user/queue/something queue, you can send a message to a single session with: As stated in the SimpMessageSendingOperations Javadoc, since your user name is actually a sessionId, you MUST set that as … Read more

Sending message to specific user on Spring Websocket

Oh, client side no need to known about current user, server will do that for you. On server side, using following way to send message to an user: simpMessagingTemplate.convertAndSendToUser(username, “/queue/reply”, message); Note: Using queue, not topic, Spring always using queue with sendToUser On client side stompClient.subscribe(“/user/queue/reply”, handler); Explain When any websocket connection is open, Spring … Read more