15 lines
444 B
Java
15 lines
444 B
Java
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
|
|
}
|
|
}
|