From 364e2ced394f80bb3f5a1e6c6371ac287e13c748 Mon Sep 17 00:00:00 2001 From: joffrey-bion Date: Mon, 8 Feb 2021 18:22:27 +0100 Subject: Cleanup web socket config --- .../luxons/sevenwonders/server/config/WebSocketConfig.kt | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'sw-server/src') diff --git a/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/config/WebSocketConfig.kt b/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/config/WebSocketConfig.kt index 2782c670..86642258 100644 --- a/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/config/WebSocketConfig.kt +++ b/sw-server/src/main/kotlin/org/luxons/sevenwonders/server/config/WebSocketConfig.kt @@ -30,12 +30,6 @@ class WebSocketConfig( config.setApplicationDestinationPrefixes("/app", "/topic") } - private fun createTaskScheduler() = ThreadPoolTaskScheduler().apply { - poolSize = 1 - threadNamePrefix = "stomp-heartbeat-thread-" - initialize() - } - override fun registerStompEndpoints(registry: StompEndpointRegistry) { registry.addEndpoint(SEVEN_WONDERS_WS_ENDPOINT) .setHandshakeHandler(handshakeHandler()) @@ -43,9 +37,7 @@ class WebSocketConfig( } @Bean - fun handshakeHandler(): DefaultHandshakeHandler { - return AnonymousUsersHandshakeHandler() - } + fun handshakeHandler(): DefaultHandshakeHandler = AnonymousUsersHandshakeHandler() override fun configureClientInboundChannel(registration: ChannelRegistration) { registration.interceptors(topicSubscriptionInterceptor) @@ -56,3 +48,9 @@ class WebSocketConfig( return true } } + +private fun createTaskScheduler() = ThreadPoolTaskScheduler().apply { + poolSize = 1 + threadNamePrefix = "stomp-heartbeat-thread-" + initialize() +} -- cgit