@Override public void onMessage(AtmosphereResourceImpl resource, SocketIOSessionOutbound outbound, String message) { startHeartbeatTimer(); if (atmosphereHandler != null && message != null) { try { synchronized (atmosphereHandler) { if (SocketIOAtmosphereHandler.class.isAssignableFrom(atmosphereHandler.getClass())) { SocketIOAtmosphereHandler.class.cast(atmosphereHandler).onMessage(resource, outbound, message); } else { SocketIOProtocol p = mapper.readValue(message, SocketIOProtocol.class); for (String msg : p.getArgs()) { AtmosphereRequest r = resource.getRequest(); r.setAttribute(SocketIOProtocol.class.getName(), p); r.body(msg).method("POST"); resource.disableSuspend(true); atmosphereHandler.onRequest(resource); } } } } catch (Throwable e) { logger.error("Session[" + sessionId + "]: Exception thrown by SocketIOInbound.onMessage()", e); } } }
@Override public void onMessage(AtmosphereResourceImpl resource, SocketIOSessionOutbound outbound, String message) { startHeartbeatTimer(); if (atmosphereHandler != null && message != null) { try { synchronized (atmosphereHandler) { if (SocketIOAtmosphereHandler.class.isAssignableFrom(atmosphereHandler.getClass())) { SocketIOAtmosphereHandler.class.cast(atmosphereHandler).onMessage(resource, outbound, message); } else { SocketIOProtocol p = mapper.readValue(message, SocketIOProtocol.class); for (String msg : p.getArgs()) { AtmosphereRequest r = resource.getRequest(); r.setAttribute(SocketIOProtocol.class.getName(), p); r.body(msg).method("POST"); resource.disableSuspend(true); atmosphereHandler.onRequest(resource); } } } } catch (Throwable e) { logger.error("Session[" + sessionId + "]: Exception thrown by SocketIOInbound.onMessage()", e); } } }