added chats with another users
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user