0

AWS EBでTomcatを使用しています。私はtechスタックSpring 4とJava 8でSpringブートを使用してアプリケーションを開発しました。私のアプリケーションはSpring WebSocketを使用してユーザーに通知します。以下は、AWS EBに配備されたときこれはあなたが私がこれを解決する方法を教えてくださいでした私は、エラーAWSのWebsocket ElasticBeanstalk Tomcat&Springが動作しない

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 

の下に取得しています私の地元では正常に動作しているjavascriptのエントリ

<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); 
}); 

のですか?

答えて

0

セキュリティグループの受信規則を追加することでこの問題が解決されました。 EC2ダッシュボードにルールを追加してください>(左ペインの)NETWORK &セキュリティ>セキュリティグループ>インバウンド

enter image description here

関連する問題