I\'m trying to make a connection between client and server via Spring webSocket and I\'m doing this by the help of this link. I want Controller to send a \"hello\" to client eve
Please reffer to this portion of the documentation. The way you are trying to send a message is totally wrong. I would modify your above class as follows:
@EnableScheduling
@Controller
public class GreetingController {
@Autowired
private SimpMessagingTemplate template;
@Scheduled(fixedRate = 5000)
public void greeting() {
Thread.sleep(1000); // simulated delay
System.out.println("scheduled");
this.template.convertAndSend("/topic/greetings", "Hello");
}
}