No cookies during / info request using sockjs and stomp

I am trying to use Spring Security with websockets. As an example, I use spring -websocket-chat ( https://github.com/salmar/spring-websocket-chat ), a demo application from the "Deep dive into websockets" talk. In this application, CookieHttpSessionStrategy uses to store the session identifier stored during authentication. Cookie sends with / info request. Here is the code demonstrating the connection to the server via sockjs (this request sends cookies) https://github.com/salmar/spring-websocket-chat/blob/master/src/main/webapp/js/services.js . I wrote my own client that uses sockjs and stomps, but there are no cookies sent in the / info request. Here is my code

$connectButton.click(function () {
    var serverHost = $host.val();
    console.log("sockjs created");
    stomp = Stomp.over(new SockJS(serverHost));
    console.log("stomp over");
    stomp.connect({},
        function () {
            console.log("connected");
        },
        function () {
            console.log("error");
        })
    console.log("pressed");
});
+4
1

, cookie SockJS ( ). SockJS 1.0.3 URL- . , JWT .

  var socket = new SockJS('http://localhost/ws?token=AAA');
  var stompClient = Stomp.over(socket);
  stompClient.connect({}, function(frame) {
      stompClient.subscribe('/topic/echo', function(data) {
        // topic handler
      });
    }
  }, function(err) {
    // connection error
  });

, websocket, "? = AAA"

http://localhost/ws/info?token=AAA&t=1446482506843

http://localhost/ws/515/z45wjz24/websocket?token=AAA

Spring , , .

cookie PS .

+2

All Articles