Skip to content

Commit b62c471

Browse files
committed
✨ 웹소켓 config 파일 생성
1 parent 162c62c commit b62c471

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package io.f1.backend.global.config;
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+
14+
15+
@Override
16+
public void registerStompEndpoints(StompEndpointRegistry registry) {
17+
registry.addEndpoint("/ws/game-room")
18+
.setAllowedOriginPatterns("*")
19+
.withSockJS();
20+
}
21+
22+
@Override
23+
public void configureMessageBroker(MessageBrokerRegistry registry) {
24+
registry.enableSimpleBroker("/sub");
25+
registry.setApplicationDestinationPrefixes("/pub");
26+
}
27+
28+
29+
}

0 commit comments

Comments
 (0)