| | |
| | | @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() { |
| | |
| | | while (!currentThread().isInterrupted()) { |
| | | Response groupWithStationAndAlarm = baoJiGroupService.getGroupWithStationAndAlarm(userId); |
| | | session.getBasicRemote().sendObject(groupWithStationAndAlarm); |
| | | sleep(4000); |
| | | sleep(10000); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |