How do I capture and log STOMP heart-beats sent by the clients and by the server?
I have SpringBoot configuration below for websockets using STOMP
@Configuration
@EnableWebSocketMessageBroker
public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {
@Override
public void configureMessageBroker(MessageBrokerRegistry config) {
ThreadPoolTaskScheduler taskScheduler = new ThreadPoolTaskScheduler();
taskScheduler.setPoolSize(1);
taskScheduler.setThreadNamePrefix("-api-heartbeat-thread-");
taskScheduler.initialize();
config.enableSimpleBroker("/topic")
.setHeartbeatValue(new long[]{25000, 25000})
.setTaskScheduler(taskScheduler);
config.setApplicationDestinationPrefixes("/api");
}
@Override
public void registerStompEndpoints(StompEndpointRegistry registry) {
registry.addEndpoint("/api-websocket").setAllowedOrigins("*");
}
}
-
A client should send a heart-beat every 25 seconds (25000 milliseconds). How can I capture and log this heartbeat in Spring Application?
-
The server is also supposed to send a heat-beat to the client every 25 seconds. How can I
console.log();
this heart-beat in a Javascript application?
I might be missing something but I have searched extensively and could not find a solution.