Spaces:
Sleeping
Sleeping
Commit
·
6d134df
1
Parent(s):
46b8368
changes
Browse files
src/main/java/ai/giskard/learnspringwebsockets/WebSocketConfig.java
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
package ai.giskard.learnspringwebsockets;
|
| 2 |
+
|
| 3 |
+
import org.springframework.context.annotation.Configuration;
|
| 4 |
+
import org.springframework.messaging.simp.config.MessageBrokerRegistry;
|
| 5 |
+
import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker;
|
| 6 |
+
import org.springframework.web.socket.config.annotation.StompEndpointRegistry;
|
| 7 |
+
import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer;
|
| 8 |
+
|
| 9 |
+
@Configuration
|
| 10 |
+
@EnableWebSocketMessageBroker
|
| 11 |
+
public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {
|
| 12 |
+
|
| 13 |
+
@Override
|
| 14 |
+
public void registerStompEndpoints(StompEndpointRegistry registry) {
|
| 15 |
+
registry.addEndpoint("/portfolio");
|
| 16 |
+
}
|
| 17 |
+
|
| 18 |
+
@Override
|
| 19 |
+
public void configureMessageBroker(MessageBrokerRegistry config) {
|
| 20 |
+
config.setApplicationDestinationPrefixes("/app");
|
| 21 |
+
config.enableSimpleBroker("/topic", "/queue");
|
| 22 |
+
}
|
| 23 |
+
}
|