AWS中的Websocket ElasticBeanst Tomcat&Spring不起作用
问题描述:
我在AWS EB中使用Tomcat。我已经开发了一个应用程序,使用Spring启动技术与Spring 4和Java 8技术。我的应用程序使用Spring WebSocket向用户发送通知。下面是JavaScript项AWS中的Websocket ElasticBeanst Tomcat&Spring不起作用
<script src="https://cdnjs.cloudflare.com/ajax/libs/sockjs-client/1.1.4/sockjs.min.js" ></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/stomp.js/2.3.3/stomp.min.js" ></script>
// Create and init the SockJS object
var socket = new SockJS('/partnervestcrm/message');
var stompClient = Stomp.over(socket);
// Subscribe the '/notify' channell
stompClient.connect({}, function(frame) {
stompClient.subscribe('/user/queue/notify', function(notification) {
// Call the notify function when receive a notification
//notify(JSON.parse(notification.body).message);
notify(JSON.parse(notification.body));
});
}, function(error) {
alert("STOMP error " + error);
});
这是工作的罚款在我的地方在部署到AWS EB我收到以下错误
WebSocket connection to 'ws://xxxxx/notification/298/plu4ia32/websocket' failed: Error during WebSocket handshake: Unexpected response code: 400
WrappedWebSocket @ VM152:164
e.exports @ websocket.js:6
r @ websocket.js:32
r._connect @ main.js:219
r._receiveInfo @ main.js:193
n @ emitter.js:30
r.emit @ emitter.js:50
(anonymous) @ info-receiver.js:67
n @ emitter.js:30
r.emit @ emitter.js:50
(anonymous) @ info-ajax.js:37
n @ emitter.js:30
r.emit @ emitter.js:50
xhr.onreadystatechange @ abstract-xhr.js:124
可否请你让我知道如何解决这个问题?