Using WebSocket to build an interactive web application :: Learn how to the send and receive messages between a browser and the server over a WebSocket
@EnableWebSocketMessageBroker
@Service
public class QuotesSocket {
@Value("${app.quotes.socket.url}")
private String url;
private Logger logger = LogManager.getLogger(QuotesStompSessionHandler.class);
WebSocketStompClient webSocketStompClient;
@PostConstruct
public void connect() {
WebSocketClient client = new StandardWebSocketClient();
webSocketStompClient = new WebSocketStompClient(client);
webSocketStompClient.setMessageConverter(new MappingJackson2MessageConverter());
StompSessionHandler sessionHandler = new QuotesStompSessionHandler();
webSocketStompClient.connect(url, sessionHandler);
new Scanner(System.in).nextLine();
}
@EnableWebSocket
public class WebSocketConfig implements WebSocketConfigurer {
@Override
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
}
}
WebSocketClient is in spring-webflux. I guess you forgot to include a dependency? Is this relevant to the guide? I'm guessing not, but if you think it is just squawk and we can dig into it more.
Please help me.