package com.jcdm.framework.websocket;
|
|
import com.jcdm.common.core.domain.AjaxResult;
|
import com.jcdm.common.core.page.TableDataInfo;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.RestController;
|
|
import javax.websocket.Session;
|
import javax.websocket.server.PathParam;
|
import java.util.List;
|
import java.util.Map;
|
|
@RestController("/socketController")
|
public class PostController {
|
|
@GetMapping("/postWebsocket")
|
public AjaxResult list(@PathParam("locationCode") String locationCode)
|
{
|
Map<String, Session> map = WebSocketUsers.getUsers();
|
//1、监听kepserver地址 比如:OP.OP1010.START 、OP.OP1020.START 、OP.OP1030.START
|
//2、当其中一个点位发生变化时,判断该点位是哪一个工位
|
//
|
WebSocketUsers.sendMessageToUserByText(map.get(locationCode), "1");
|
|
return AjaxResult.success();
|
}
|
|
|
}
|