我正在使用SockJS客户端。 SockJS构造函数有一个相对URL作为如何使用sock js的安全websockets
var ws= new SockJS('/spring-websocket-test/sockjs/echo', undefined,{protocols_whitelist: [transport]});
我们在哪里表明WSS://被用来代替WS://。如果我尝试绝对URL,它会给出错误:
XMLHttpRequest cannot load ws://localhost:8080/appname/app. Cross origin requests are only supported for HTTP.
_ws_onclose. wasClean: false code: 1002 reason: Can't connect to server
不知道为什么会出现此错误。在Spring Server实现上需要的任何类似的配置?
+1 for ur answer。它帮助了我。也请帮助这个http://stackoverflow.com/questions/29035552/sockjs-tomcat8-websockets-404-error?noredirect=1#comment46424068_29035552 –