내가 구르기 클라이언트를 사용하여 요청을 보내고 때, 로그 출력은, 테야을 사용하여 웹 소켓 클라이언트를 쓰고 있어요 :WebSocketAnnotationMethodMessageHandler 일치하는 방법
15:17:44.688]-[clientInboundChannel-59]-[org.springframework.web.socket.messaging.WebSocketAnnotationMethodMessageHandler]-{Searching methods to handle SEND /app/vehicle session=qnlerizz}
15:17:44.688]-[clientInboundChannel-59]-[org.springframework.web.socket.messaging.WebSocketAnnotationMethodMessageHandler]-{No matching methods.}
이 클라이언트가 문제가되지 않습니다 보여줍니다.
public class WebSocketConfig extends AbstractWebSocketMessageBrokerConfigurer {
@Override
public void configureMessageBroker(MessageBrokerRegistry config) {
config.enableSimpleBroker("/topic");
config.setApplicationDestinationPrefixes("/app");
}
@Override
public void registerStompEndpoints(StompEndpointRegistry registry) {
registry.addEndpoint("/vehicle").withSockJS();
}
}
이가이다 : 이것은 내 웹 구성
@Controller
@Log4j2
public class WebSocketController {
public SimpMessagingTemplate template;
@Autowired
public WebSocketController(SimpMessagingTemplate template) {
this.template = template;
}
@MessageMapping("/vehicle")
@SendTo("/topic/location")
public void getloc() throws Exception {
try {
for (int i = 0; i < 10; i++) {
template.convertAndSend("/topic/location", "aaaaaaa");
}
} catch (Exception e) {
log.error(e);
}
}
}
입니다 : 그리고 서버는 이미 핸들 method.This 있었다 오전 request.But을 처리하기 위해 일치하는 URL을 코드입니다 찾을 수 없습니다 고객 코드 :
function connect() {
var socket = new SockJS('/clbs/vehicle');
stompClient = Stomp.over(socket);
stompClient.connect({}, function (frame) {
setConnected(true);
console.log('Connected: ' + frame);
stompClient.subscribe('/topic/location', function (greeting) {
showGreeting(JSON.parse(greeting.body).content);
});
});
}
stompClient.send("/app/vehicle",{},JSON.stringify("bbb"));
어떻게해야합니까?
추 신 : 컨트롤러 WebSocketController
은 이미 자동 스캔입니다.
JDK : 1.8 톰캣 : 8.0.36 봄 : 4.2.6
나는 이일이 질문에 대한 투쟁이다.