Skip to content

Commit

Permalink
feat: Pub/Sub 기반 WebSocket 서버 구성
Browse files Browse the repository at this point in the history
resolve: #33
  • Loading branch information
BinarySstar committed Jan 30, 2025
1 parent 2ad1ba4 commit a0bec95
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package univ.goormthon.kongju.domain.chat.controller;

import lombok.RequiredArgsConstructor;
import org.springframework.messaging.handler.annotation.MessageMapping;
import org.springframework.messaging.simp.SimpMessagingTemplate;
import org.springframework.stereotype.Controller;

@Controller
@RequiredArgsConstructor
public class ChatController {

private final SimpMessagingTemplate template;
@MessageMapping("/chat")
public void sendMessage(String message) {
this.template.convertAndSend("/sub", message);
}

}

0 comments on commit a0bec95

Please sign in to comment.