I'm new to web socket programming. I have more than 10 methods annotated with @GetMapping
, where the returned data is read from a MySQL database.
Can anyone help me to know how to write WebSockets.
My WebRestController.java looks like the below:
@CrossOrigin(origins = "http://localhost:4200", allowedHeaders="*")
@RestController
@RequestMapping("/api")
public class WebRestController {
@GetMapping("/summary")
public String Summary() { /* ... */}
@GetMapping("/erday")
public String Erday(String erday) { /* ... */}
@GetMapping("/count")
public String Count(@RequestParam Map<String,String> queryParam,
String date, String target) { /* ... */}
@GetMapping("/details")
public String Details(@RequestParam Map<String,String> queryParam,
String date, String target) { /* ... */}
@GetMapping("/devmawah")
public String DevMawah(@RequestParam Map<String,String> queryParam,
String date, String target) { /* ... */}
// ....
}
I tried before many times in internet to find the solution, but couldn't find it. All I found are examples for Chat applications, which have 2 endpoints to send and receive.