| | |
| | | |
| | | import java.util.List; |
| | | |
| | | import javax.websocket.Session; |
| | | |
| | | import cn.hutool.json.JSONArray; |
| | | import cn.hutool.json.JSONObject; |
| | | |
| | | public class PlcHold extends Thread { |
| | |
| | | while (this != null) { |
| | | try { |
| | | |
| | | Thread.sleep(15000); |
| | | Thread.sleep(2000); |
| | | } catch (InterruptedException e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | |
| | | //推送到前端 |
| | | |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.append("params", new short[] { 0, 1, 2, 3, 4, 5, }); |
| | | jsonObject.append("params", new short[] { 0, 1, 2, 3, 4, 5 }); |
| | | WebSocketServer sendwServer = WebSocketServer.sessionMap.get("talkvue"); |
| | | if (sendwServer != null) { |
| | | sendwServer.sendMessage(jsonObject.toString()); |
| | | } |
| | | |
| | | |
| | | JSONObject jsonObject2 = new JSONObject(); |
| | | jsonObject2.append("params", new short[] { 0, 3, 2, 3, 4, 5 }); |
| | | WebSocketServer sendwServer2 = WebSocketServer.sessionMap.get("action"); |
| | | if (sendwServer2 != null) { |
| | | sendwServer2.sendMessage(jsonObject2.toString()); |
| | | } |
| | | } |
| | | } |
| | | } |