| | |
| | | package com.whyc.webSocket; |
| | | |
| | | import com.whyc.config.WebSocketConfig; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.factory.ThreadPoolExecutorFactory; |
| | | import com.whyc.pojo.Battinf; |
| | |
| | | * 运维分配-班组管理 |
| | | */ |
| | | @Component |
| | | @ServerEndpoint(value = "/groupStation",encoders = WebSocketEncoder.class) |
| | | @ServerEndpoint(value = "/groupStation",encoders = WebSocketEncoder.class,configurator = WebSocketConfig.class) |
| | | public class GroupStationSocket { |
| | | private volatile Thread thread; |
| | | |
| | |
| | | @OnOpen |
| | | public void onOpen(Session session, EndpointConfig config){ |
| | | this.session = session; |
| | | //HttpSession httpSession = (HttpSession) config.getUserProperties().get("httpSession"); |
| | | //UserInf user = (UserInf) httpSession.getAttribute("user"); |
| | | //final int userId = user.getUId().intValue(); |
| | | final int userId = 1001; |
| | | HttpSession httpSession = (HttpSession) config.getUserProperties().get("httpSession"); |
| | | UserInf user = (UserInf) httpSession.getAttribute("user"); |
| | | final int userId = user.getUId().intValue(); |
| | | //final int userId = 1001; |
| | | Thread thread = new Thread() { |
| | | @Override |
| | | public void run() { |