I'm new to Spring and working on a university project.
The goal: Have a REST POST endpoint that saves data, but also sends a broadcast message using websocket.
Now, my RestController seems to be working fine, but dont really know how to implement the websocket part?
Here is how the endpoint looks like:
@PostMapping("/employees")
Employee newEmployee(@RequestBody Employee newEmployee) {
return repository.save(newEmployee);
}
My previous ideas:
-Create a @Controller with a method that has @SendTo annotation?
-Can I use the @SendTo on the RestController newEmployee method?
What is the most efficient way?