/** * When user leaves the activity. */ @OnClose public void unregisterUser(Session websocket, CloseReason reason) { Long toolContentID = Long .valueOf(websocket.getRequestParameterMap().get(AttributeNames.PARAM_TOOL_CONTENT_ID).get(0)); websockets.get(toolContentID).remove(websocket); if (log.isDebugEnabled()) { // If there was something wrong with the connection, put it into logs. log.debug("User " + websocket.getUserPrincipal().getName() + " left Dokumaran with Tool Content ID: " + toolContentID + (!(reason.getCloseCode().equals(CloseCodes.GOING_AWAY) || reason.getCloseCode().equals(CloseCodes.NORMAL_CLOSURE)) ? ". Abnormal close. Code: " + reason.getCloseCode() + ". Reason: " + reason.getReasonPhrase() : "")); } }
/** * When user leaves the activity. */ @OnClose public void unregisterUser(Session websocket, CloseReason reason) { Long toolSessionId = Long .valueOf(websocket.getRequestParameterMap().get(AttributeNames.PARAM_TOOL_SESSION_ID).get(0)); websockets.get(toolSessionId).remove(websocket); if (log.isDebugEnabled()) { // If there was something wrong with the connection, put it into logs. log.debug("User " + websocket.getUserPrincipal().getName() + " left Leader Selection with Tool Session ID: " + toolSessionId + (!(reason.getCloseCode().equals(CloseCodes.GOING_AWAY) || reason.getCloseCode().equals(CloseCodes.NORMAL_CLOSURE)) ? ". Abnormal close. Code: " + reason.getCloseCode() + ". Reason: " + reason.getReasonPhrase() : "")); } }
/** * If there was something wrong with the connection, put it into logs. */ @OnClose public void unregisterUser(Session session, CloseReason reason) { Long lessonId = Long.valueOf(session.getRequestParameterMap().get(AttributeNames.PARAM_LESSON_ID).get(0)); Set<Websocket> lessonWebsockets = PresenceWebsocketServer.websockets.get(lessonId); Iterator<Websocket> websocketIterator = lessonWebsockets.iterator(); while (websocketIterator.hasNext()) { Websocket websocket = websocketIterator.next(); if (websocket.session.equals(session)) { websocketIterator.remove(); break; } } if (PresenceWebsocketServer.log.isDebugEnabled()) { PresenceWebsocketServer.log.debug( "User " + session.getUserPrincipal().getName() + " left Presence Chat with lessonId: " + lessonId + (!(reason.getCloseCode().equals(CloseCodes.GOING_AWAY) || reason.getCloseCode().equals(CloseCodes.NORMAL_CLOSURE)) ? ". Abnormal close. Code: " + reason.getCloseCode() + ". Reason: " + reason.getReasonPhrase() : "")); } }
@OnClose public void unregisterUser(Session websocket, CloseReason reason) throws JSONException, IOException { String login = websocket.getUserPrincipal().getName(); if (login == null) { return; } Integer organisationId = Integer .valueOf(websocket.getRequestParameterMap().get(AttributeNames.PARAM_ORGANISATION_ID).get(0)); KumaliveDTO kumalive = kumalives.get(organisationId); if (kumalive == null) { return; } KumaliveUser user = kumalive.learners.remove(login); if (user != null) { Integer userId = user.userDTO.getUserID(); if (kumalive.raisedHand != null) { kumalive.raisedHand.remove(userId); } if (userId.equals(kumalive.speaker)) { kumalive.speaker = null; } } sendRefresh(kumalive); }
/** * Removes Learner websocket from the collection. */ @OnClose public void unregisterUser(Session session, CloseReason reason) { String login = session.getUserPrincipal().getName(); if (login == null) { return; } Long lessonId = Long.valueOf(session.getRequestParameterMap().get(AttributeNames.PARAM_LESSON_ID).get(0)); Map<String, Session> lessonWebsockets = CommandWebsocketServer.websockets.get(lessonId); if (lessonWebsockets == null) { return; } lessonWebsockets.remove(login); }
/** * When user leaves the activity. */ @OnClose public void unregisterUser(Session session, CloseReason reason) { Long toolSessionId = Long .valueOf(session.getRequestParameterMap().get(AttributeNames.PARAM_TOOL_SESSION_ID).get(0)); Set<Websocket> sessionWebsockets = LearningWebsocketServer.websockets.get(toolSessionId); Iterator<Websocket> websocketIterator = sessionWebsockets.iterator(); while (websocketIterator.hasNext()) { Websocket websocket = websocketIterator.next(); if (websocket.session.equals(session)) { websocketIterator.remove(); break; } } if (LearningWebsocketServer.log.isDebugEnabled()) { LearningWebsocketServer.log.debug( "User " + session.getUserPrincipal().getName() + " left Chat with toolSessionId: " + toolSessionId + (!(reason.getCloseCode().equals(CloseCodes.GOING_AWAY) || reason.getCloseCode().equals(CloseCodes.NORMAL_CLOSURE)) ? ". Abnormal close. Code: " + reason.getCloseCode() + ". Reason: " + reason.getReasonPhrase() : "")); } }
/** * When user leaves the activity. */ @OnClose public void unregisterUser(Session websocket, CloseReason reason) { Long toolSessionId = Long .valueOf(websocket.getRequestParameterMap().get(AttributeNames.PARAM_TOOL_SESSION_ID).get(0)); LearningWebsocketServer.websockets.get(toolSessionId).remove(websocket); if (LearningWebsocketServer.log.isDebugEnabled()) { // If there was something wrong with the connection, put it into logs. LearningWebsocketServer.log.debug("User " + websocket.getUserPrincipal().getName() + " left Scratchie with Tool Session ID: " + toolSessionId + (!(reason.getCloseCode().equals(CloseCodes.GOING_AWAY) || reason.getCloseCode().equals(CloseCodes.NORMAL_CLOSURE)) ? ". Abnormal close. Code: " + reason.getCloseCode() + ". Reason: " + reason.getReasonPhrase() : "")); } }
/** * When user leaves the activity. */ @OnClose public void unregisterUser(Session websocket, CloseReason reason) { Long toolSessionId = Long .valueOf(websocket.getRequestParameterMap().get(AttributeNames.PARAM_TOOL_SESSION_ID).get(0)); LearningWebsocketServer.websockets.get(toolSessionId).remove(websocket); if (LearningWebsocketServer.log.isDebugEnabled()) { // If there was something wrong with the connection, put it into logs. LearningWebsocketServer.log.debug("User " + websocket.getUserPrincipal().getName() + " left Scribe with Tool Session ID: " + toolSessionId + (!(reason.getCloseCode().equals(CloseCodes.GOING_AWAY) || reason.getCloseCode().equals(CloseCodes.NORMAL_CLOSURE)) ? ". Abnormal close. Code: " + reason.getCloseCode() + ". Reason: " + reason.getReasonPhrase() : "")); } }
/** * Callback hook for Connection close events. * * @param userSession * the userSession which is getting closed. * @param reason * the reason for connection close */ @OnClose public void onClose(Session userSession, CloseReason reason) { System.out.println( "WebsocketClientEndpoint.onClose(): Closing Websocket.... Reason[" + reason.getReasonPhrase() + "]"); try { this.userSession.close(); } catch (IOException e) { System.out.println("WebsocketClientEndpoint.onClose(): ERROR: IOException on userSession close!!!"); e.printStackTrace(); } this.userSession = null; // stop timer if running if (hbTimer != null) { hbTimer.cancel(); hbTimer = null; } // Notify session closed sessionNotifier.notifyWsSessionClosed(terminate); }
@OnClose public void onClose(Session userSession, CloseReason reason) throws InterruptedException { String sessionIp = ((TyrusSession)userSession).getRemoteAddr(); InetAddress identity; try { identity = InetAddress.getByName(sessionIp); } catch (UnknownHostException er) { return; } try { userSession.close(); } catch (IOException e) { return; } localOpenSessions.remove(identity); localPeers.remove(identity); receiveMap.get(userSession).close(); receiveMap.remove(userSession); }
@OnClose public void onClose(CloseReason closeReason, Session session) { Optional<String> endpointIdOptional = registry.get(session); String combinedEndpointId; if (endpointIdOptional.isPresent()) { combinedEndpointId = endpointIdOptional.get(); LOG.debug("Web socket session closed"); LOG.debug("Endpoint: {}", combinedEndpointId); LOG.debug("Close reason: {}:{}", closeReason.getReasonPhrase(), closeReason.getCloseCode()); registry.remove(combinedEndpointId); sessionMessagesBuffer.remove(session); } else { LOG.warn("Closing unidentified session"); } }
/** * Callback when receiving closed connection from client side * * @param session the client {@link Session} * @param executionId the execution identifier from the {@link ServerEndpoint} path */ @OnClose public void closedConnection(Session session, @PathParam("execution-id") long executionId) { if (LOG.isDebugEnabled()) { LOG.debug("Session " + session.getId() + " closed connection to execution " + executionId); } mainLock.lock(); try { sessions.remove(session.getId()); Set<String> registeredSessions = executions.get(executionId); if (registeredSessions != null) { registeredSessions.remove(session.getId()); } } finally { mainLock.unlock(); } }
@OnClose public void onClose(Session session) throws InterruptedException { ClientSession clientSession = sessions.get(session.getId()); if (clientSession != null) { clientSession.onClose(); sessions.remove(session.getId()); } System.out.printf("webSocket %s session closed.", session.getId()); }
@OnClose public void onClose() { // show dialog when the web socket is disconnected Platform.runLater(() -> { dialog = new PlainDialog("�������� ������ ������ϴ�.", true); dialog.showAndWait(); }); }
/** * 连接关闭调用的方法-与前端JS代码对应 */ @OnClose public void onClose() { webSocketSet.remove(this); // 从set中删除 routetabMap.remove(userid); OnlineUserlist.remove(userid); System.out.println(userid + " -> 已下线"); String message = getMessage(userid + " -> 已下线", "notice", OnlineUserlist); broadcast(message); //singleSend(message, sn); // 广播 }
@OnClose public void handleClose(Session userSession) { if (userSession == null) { System.out.println("Session is null"); } System.err.println("[UserController] Session is closed. User terminated the program."); session = null; exitUserAtGroup(); System.out.println("[handleClose] " + UploadServlet.uploadTime()); // System.out.println("session open: " + session.isOpen()); }
@OnClose public void onCloseCallback() { if(!dupUserDetected){ processLogout(); } }
@OnClose public void end() { connections.remove(this); String message = String.format("* %s %s", nickname, "has disconnected."); broadcast(message); }
@OnClose public void end(Session session) { log.info("*** WebSocket closed from sessionId " + session.getId()); for (Map.Entry<String, Session> entry : sessionMap.entrySet()) { if (entry.getValue().getId().equals(session.getId())) { sessionMap.remove(entry.getKey()); } } }
@OnClose public void onCloseCallback() { if (!dupUserDetected) { USERS.remove(this.user); SESSIONS.remove(s); processLogout(); } }
/**连接关闭调用的方法*/ @OnClose public void onClose(Session session){ if(mapSU.get(session)!=null){ Long userId=mapSU.get(session); mapUS.remove(userId); mapSU.remove(session); onlineCount--; System.out.println("用户"+userId+"退出WebSocket!当前在线人数为" + onlineCount); } }
/** * 连接关闭调用的方法 */ @OnClose public void onClose() { webSocketSet.remove(this); //从set中删除 subOnlineCount(); //在线数减1 log.debug("有一连接关闭!当前在线人数为" + getOnlineCount()); }
@OnClose public void onClose(Session session, CloseReason closeReason) { try { ThreadMsgManager.dispatchThreadMsg(WSMsg.WEBSOCKET_CLIENT_DISCONNECT, null, session); } catch (Exception e) { if (WSManager.log != null) { WSManager.log.error("MsgManager.dispatchMsg error", e); } } }
@OnClose public void onClose(Session session, CloseReason closeReason) { try { MsgManager.dispatchMsg(WSMsg.WEBSOCKET_CLIENT_DISCONNECT, null, session); } catch (Exception e) { if (WSManager.log != null) { WSManager.log.error("MsgManager.dispatchMsg error", e); } } }
@OnClose public void onClose(Session session, CloseReason reason) { System.out.println("Session " + session.getId() + " has ended. Reason: " + reason); if (user != null) { locationService.sendClosingLocation(user); System.out.println("Closed out user: " + user); } else { System.out.println("Something went wrong with setting the user"); } }
@OnClose @Override public void onClose(Session session, CloseReason reason) { this.log.info("WebSocket connection closed. [id={},principle={},code={},reason={}]", session.getId(), session.getUserPrincipal(), reason.getCloseCode(), reason.getReasonPhrase()); final WebSocketContext ctx = webSocketContext(this.beanManager); try (QuietClosable c = ctx.activate(session)) { this.registry.unregister(session); this.sessionEvent.select(cito.annotation.OnClose.Literal.onClose()).fire(session); } ctx.dispose(session); }
@OnClose public void close(Session session) { SessionListener sessionListener = SESSIONS.get(session.getId()); if (sessionListener != null) { sessionListener.detachListeners(this.registry); SESSIONS.remove(session.getId()); } }
/** * Closes a session * * @param session * The session to close * @param reason * The reason for closing */ @OnClose public void close(Session session, CloseReason reason) { LOG.info("Closing session {}. Reason {}", session.getId(), reason); try { session.close(); } catch (IOException e) { LOG.warn("Couldn't close {}. Reason {}", session.getId(), e.getMessage()); } sessions.remove(session); }
/** * Closes a session * * @param session * The session to close * @param reason * The reason for closing */ @OnClose public void close(Session session, CloseReason reason) { if (session.getRequestURI().getPath().startsWith(RT_EVENT_ENDPOINT)) { LOG.info("Closing session {}. Reason {}", session.getId(), reason); try { sessions.remove(session); session.close(); } catch (IOException e) { LOG.warn("Couldn't close {}", session.getId()); } } else { connectedToCompute = false; } }
/** The user closes the connection. * Note: you can't send messages to the client from this method. */ @OnClose public void onClose(final Session session) { Date now = new Date(); log(now, session, "-- Session closed --"); try { saveInteraction(new Interaction(now, session, "CBYE", "")); } catch (SQLException e) { // Ignore this exception. e.printStackTrace(); } }
@OnClose public void onClose(Session session,@PathParam("username") String username) { try{ client.remove(session); user.remove(URLEncoder.encode(username, "UTF-8")); session.close(); }catch(Exception e){ //do nothing } }
@OnClose public void unsubscribe(Session session, CloseReason reason) { synchronized(topicSubscribers) { // remove session for (List<Session> sessions : topicSubscribers.values()) { if (sessions.contains(session)) sessions.remove(session); } // remove topics without any sessions for (String topic : topicSubscribers.keySet()) { if (topicSubscribers.get(topic).isEmpty()) topicSubscribers.remove(topic); } } }
/** * 有人离开房间 */ @OnClose public void onClose() { webSocketSet.remove(this); subOnlineCount(); System.out.println("有一用户关闭!当前在线人数为" + getOnlineCount()); }
@Override @OnClose public void onClose(Session session, CloseReason closeReason) { try { if (tunnel != null) tunnel.close(); } catch (GuacamoleException e) { logger.debug("Unable to close WebSocket tunnel.", e); } }
@OnClose public void onClose(Session session) { sessions.remove(session); Message message = new Message(Json.createObjectBuilder().add("type", "text").add("data", "User has disconnected").build()); for (Session s : sessions) { try { s.getBasicRemote().sendObject(message); } catch (IOException | EncodeException ex) { ex.printStackTrace(); } } log.debug("User disconnected"); }
/** * On web socket close. * * @param reason the reason */ @OnClose public void onWebSocketClose(CloseReason reason) { boolean isRemove = ThreadEntryPointIote2eRequest.serverSideSocketIote2eRequest.remove(keyCommon, this); logger.info("Socket Closed: " + reason + ", isRemove=" + isRemove); shutdownThreadIgniteSubscribe(); }
/** * On web socket close. * * @param reason the reason */ @OnClose public void onWebSocketClose(CloseReason reason) { boolean isRemove = ThreadEntryPointNearRealTime.serverSideSocketNearRealTimes.remove(Iote2eConstants.SOCKET_KEY_NRT, this); logger.info("Socket Closed: " + reason + ", isRemove=" + isRemove); shutdownThreadIgniteSubscribe(); }
@OnClose public void close(CloseReason reason) { String reasonPhrase = reason != null ? reason.getReasonPhrase() : "<no reason provided>"; eventLogger.logEvent(PurifinityServerStatusSocketEvents .createSocketCloseEvent(reasonPhrase)); }
@OnClose public void close(CloseReason reason) { String reasonPhrase = reason != null ? reason.getReasonPhrase() : "<no reason provided>"; eventLogger.logEvent(PurifinityJobsSocketEvents .createSocketCloseEvent(reasonPhrase)); }