Notification Code.

This commit is contained in:
piyushkag
2024-12-13 20:57:58 +05:30
parent 2a5f344ea0
commit d8e51f3a70
25 changed files with 520 additions and 6 deletions

View File

@@ -109,6 +109,7 @@ public class SecurityConfig {
.requestMatchers("/v1/api-docs/**").permitAll() // API docs
.requestMatchers("/v1/user/reset-password/initiate").permitAll()
.requestMatchers("/v1/user/reset-password").permitAll()
.requestMatchers("/wss/**").permitAll() // if this is not running use this /gs-guide-websocket
.anyRequest().authenticated())
.sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.IF_REQUIRED))
.exceptionHandling(exceptionHandling -> exceptionHandling

View File

@@ -0,0 +1,32 @@
package net.gepafin.tendermanagement.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.messaging.simp.config.MessageBrokerRegistry;
import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker;
import org.springframework.web.socket.config.annotation.StompEndpointRegistry;
import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer;
@Configuration
@EnableWebSocketMessageBroker
public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {
@Override
public void configureMessageBroker(MessageBrokerRegistry config) {
// Enable a simple broker for both /topic (broadcast messages) and /queue (user-specific messages)
config.enableStompBrokerRelay("/topic")
.setRelayHost("localhost")
.setRelayPort(61613) // RabbitMQ is running on port 61613
.setClientLogin("guest")
.setClientPasscode("guest");
// Prefix for application messages (user sends messages to /app endpoints)
config.setApplicationDestinationPrefixes("/app");
}
@Override
public void registerStompEndpoints(StompEndpointRegistry registry) {
registry.addEndpoint("/gs-guide-websocket").setAllowedOrigins("http://127.0.0.1:5501/", "http://localhost:5500", "http://localhost:5501", "http://127.0.0.1:5500/")
.withSockJS();
}
}