0

AWS EB에서 Tomcat을 사용하고 있습니다. 테크 스택 Spring 4와 Java 8로 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 

당신이 날은이 문제를 해결하는 방법을 알려 주시기 바랍니다 수에 배포 할 때 아래는 자바 스크립트 항목 내 로컬에서

<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 대시 보드에 규칙을 추가하세요> (왼쪽 창에서) 네트워크 & 보안> 보안 그룹> 인바운드

enter image description here