File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
src/main/java/cmf/commitField/global/websocket Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change 44import cmf .commitField .global .exception .CustomException ;
55import lombok .extern .slf4j .Slf4j ;
66import org .springframework .stereotype .Component ;
7- import org .springframework .web .socket .CloseStatus ;
8- import org .springframework .web .socket .WebSocketHandler ;
9- import org .springframework .web .socket .WebSocketMessage ;
10- import org .springframework .web .socket .WebSocketSession ;
7+ import org .springframework .web .socket .*;
118
129import java .io .IOException ;
1310import java .util .*;
@@ -104,4 +101,13 @@ private Long extractRoomId(WebSocketSession session) {
104101 }
105102 return roomId ;
106103 }
104+ //메세지 전송
105+ public void sendMessage (String payload ) throws Exception {
106+ for (List <WebSocketSession > sessions : chatRooms .values ()) {
107+ for (WebSocketSession session : sessions ) {
108+ TextMessage msg = new TextMessage (payload );
109+ session .sendMessage (msg );
110+ }
111+ }
112+ }
107113}
You can’t perform that action at this time.
0 commit comments