diff --git a/src/main/java/com/chat/yourway/config/websocket/WebSocketConfig.java b/src/main/java/com/chat/yourway/config/websocket/WebSocketConfig.java index fb74aeee..c14d7a3e 100644 --- a/src/main/java/com/chat/yourway/config/websocket/WebSocketConfig.java +++ b/src/main/java/com/chat/yourway/config/websocket/WebSocketConfig.java @@ -6,6 +6,7 @@ import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker; import org.springframework.web.socket.config.annotation.StompEndpointRegistry; import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer; +import org.springframework.web.socket.config.annotation.WebSocketTransportRegistration; @Configuration @EnableWebSocketMessageBroker @@ -25,4 +26,11 @@ public void registerStompEndpoints(StompEndpointRegistry registry) { registry.addEndpoint(properties.getEndpoint()); registry.addEndpoint(properties.getEndpoint()).setAllowedOriginPatterns("*").withSockJS(); } + + + @Override + public void configureWebSocketTransport(WebSocketTransportRegistration registry) { + registry.setTimeToFirstMessage(properties.getTimeToFirstMessage()); + } + } diff --git a/src/main/java/com/chat/yourway/config/websocket/WebsocketProperties.java b/src/main/java/com/chat/yourway/config/websocket/WebsocketProperties.java index 83e8eca4..8c000619 100644 --- a/src/main/java/com/chat/yourway/config/websocket/WebsocketProperties.java +++ b/src/main/java/com/chat/yourway/config/websocket/WebsocketProperties.java @@ -17,5 +17,6 @@ public class WebsocketProperties { private String topicPrefix; private String notifyPrefix; private String errorPrefix; + private int TimeToFirstMessage; } diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 023afd21..ecf8cbc5 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -16,7 +16,7 @@ spring.data.redis.password=${REDIS_PASSWORD:admin} #Hibernate spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect -spring.jpa.show-sql=true +#spring.jpa.show-sql=true spring.jpa.properties.hibernate.format_sql=true spring.jpa.hibernate.ddl-auto=validate @@ -30,6 +30,7 @@ socket.endpoint=/chat socket.topic-prefix=/topic socket.notify-prefix=/specific/notify socket.error-prefix=/specific/error +socket.time-to-first-message=999999 #Security: security.jwt.token-type=Bearer @@ -58,5 +59,5 @@ spring.mail.properties.mail.smtp.starttls.required=true message.max.amount.reports=2 #Logging: -logging.level.com.chat.yourway=${LOGGING_LEVEL:info} +logging.level.com.chat.yourway=${LOGGING_LEVEL:trace}