added chats with another users

This commit is contained in:
SlimusMinus
2026-06-22 01:08:47 +03:00
parent 194b7efb8a
commit 236d00f2f9
19 changed files with 433 additions and 177 deletions

View File

@@ -1,5 +1,7 @@
package com.krylov.refound.config;
import com.krylov.refound.util.WsHandshakeInterceptor;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Configuration;
import org.springframework.messaging.simp.config.MessageBrokerRegistry;
import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker;
@@ -8,18 +10,22 @@ import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerCo
@Configuration
@EnableWebSocketMessageBroker
@RequiredArgsConstructor
public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {
private final WsHandshakeInterceptor wsHandshakeInterceptor;
@Override
public void configureMessageBroker(MessageBrokerRegistry config) {
config.enableSimpleBroker("/topic");
config.setApplicationDestinationPrefixes("/app");
public void configureMessageBroker(MessageBrokerRegistry registry) {
registry.enableSimpleBroker("/topic"); // сервер → клиент
registry.setApplicationDestinationPrefixes("/app"); // клиент → сервер
}
@Override
public void registerStompEndpoints(StompEndpointRegistry registry) {
registry.addEndpoint("/ws")
.setAllowedOriginPatterns("*")
.addInterceptors(wsHandshakeInterceptor)
.withSockJS();
}
}