if (resource != null) {
resource.getRequest().setAttribute(SocketIOAtmosphereHandler.SOCKETIO_SESSION_ID, session.getSessionId());
resource.getRequest().setAttribute(SocketIOAtmosphereHandler.SOCKETIO_SESSION_OUTBOUND, session.getTransportHandler());
session.setAtmosphereResourceImpl(resource);
resource.addEventListener(new AtmosphereResourceEventListenerAdapter() {
@Override
public void onResume(AtmosphereResourceEvent event) {
if (event.isResumedOnTimeout()) {
event.getResource().write(new SocketIOPacketImpl(PacketType.NOOP).toString());
}