use of org.thingsboard.server.extensions.api.plugins.ws.SessionEvent in project thingsboard by thingsboard.
the class DefaultWebsocketMsgHandler method handleWebSocketSessionEvent.
protected void handleWebSocketSessionEvent(PluginContext ctx, PluginWebsocketSessionRef sessionRef, SessionEventPluginWebSocketMsg wsMsg) {
String sessionId = sessionRef.getSessionId();
SessionEvent event = wsMsg.getPayload();
log.debug(PROCESSING_MSG, sessionId, event);
switch(event.getEventType()) {
case ESTABLISHED:
wsSessionsMap.put(sessionId, new WsSessionMetaData(sessionRef));
break;
case ERROR:
log.debug("[{}] Unknown websocket session error: {}. ", sessionId, event.getError().orElse(null));
break;
case CLOSED:
wsSessionsMap.remove(sessionId);
cleanupWebSocketSession(ctx, sessionId);
break;
}
}
Aggregations