package com.emergency.avenue.admin.websocket;

import com.emergency.avenue.admin.config.WebSocketServer;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class WebSocketController {

    @GetMapping("/server/push/{sid}")
    public void push(@PathVariable("sid") Integer sid) {
        if (0 == sid) {
            WebSocketServer.sendInfo(sid + "：全员注意啦！", null);
        } else {
            WebSocketServer.sendInfo(sid + "：注意啦！ -> " + (sid + 1), String.valueOf(sid + 1));
        }
    }
}