Add socketController.java

This commit is contained in:
Paramita Pahari 2025-04-02 07:11:05 +00:00
parent 97ffd735d7
commit d181275f47

14
socketController.java Normal file
View File

@ -0,0 +1,14 @@
package websocket;
import org.springframework.messaging.handler.annotation.MessageMapping;
import org.springframework.messaging.handler.annotation.SendTo;
import org.springframework.stereotype.Controller;
@Controller
public class SocketController {
@MessageMapping("/idle")
@SendTo("/topic/idleAlert")
public String handleMessage(String message) {
return message; // Send idle alert to all connected clients
}
}