Spring Boot向所有客户端推送通知

问题描述

我有一个Web应用程序,它使用spring boot作为后端,而vue.js作为前端,并且我有一个脚本python捕获帧,当获取信息时将其设置为服务器,最后将一行添加数据库,所以要在服务器添加数据库时在前面收到通知

@PostMapping("/plate")
public ResponseEntity<Void> createPositionOc(@RequestParam String plate) {

    LocalDateTime myDateObj = LocalDateTime.Now();
    DateTimeFormatter myFormatObj = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");

    List<Car> cars = carController.getAllCars();
    boolean exist = cars.stream().anyMatch(o -> o.getPlate().equals(plate));

    List<Car> carsIn = carController.getAllCarsIn();
    boolean existIn = carsIn.stream().anyMatch(o -> o.getPlate().equals(plate));


    List<Position> free = getAllPositiosFree();

    PositionOcp position = new PositionOcp(free.get(0).getId_pos(),plate,myDateObj.format(myFormatObj));

    if (exist && free.size() > 0 && !existIn) {
        PositionOcp createdPositionOc = positionOcpRepository.save(position);
        //send notification
    }    

    return null;
}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)