Websocket Spring:无法从外部客户端连接

时间:2016-09-08 05:56:12

标签: javascript spring websocket stomp sockjs

我正在尝试从外部客户端连接到我的websocket目标。我的外部客户端上有以下内容:

$(document).ready(function(){
    connect('test');

    function connect(selectedUser) {
        var socket = new SockJS("http://<my-ip>:<my-port>/Messages/getMessages");
            stompClient = Stomp.over(socket);

            stompClient.connect({}, function (frame) {
              console.log('Connected: ' + frame);
              stompClient.subscribe('/topic/newMessages/' + 'test', function (response) {
                alert("New Message!")

              });

          });
    }

});

我得到以下内容:

  

打开网络插座......   哎呦!失去与

的连接      
    

http://my-ip:my-port/Messages/getMessages

  

但是,如果我从内部客户端运行此代码,它运行正常。 现在,外部客户端在IE6上,但基于SockJS文档,这应该不是问题。

0 个答案:

没有答案
相关问题