rentaiming
2024-06-21 f8f263f9149586e9694559a79a8a6f74128b144a
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/WebSocketTestController.java
@@ -1,9 +1,10 @@
package com.ruoyi.system.controller;
import com.ruoyi.system.api.util.WebSocketUsers;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import util.WebSocketUsers;
@RestController
@RequestMapping("/websocket")
@@ -13,4 +14,9 @@
    public void push() {
        WebSocketUsers.sendMessageToUsersByText("长江长江,我是黄河!");
    }
    @GetMapping("/push/{type}/{msg}")
    public void push(@PathVariable("type") Integer type, @PathVariable("msg") String msg) {
        WebSocketUsers.sendMessageToUsersByType(type, msg);
    }
}