@Override public void operationComplete(ChannelFuture future) throws Exception { if (!future.isSuccess()) { future.channel().close(); } else { websocketChannels.add(ctx.channel()); ctx.channel().attr(ATTACHMENT).set(webSocket); if (config.noInternalAlloc()) { webSocket.resource(proxiedResource); } AtmosphereResponse response = config.noInternalAlloc() ? proxiedResponse : AtmosphereResponseImpl.newInstance(framework.getAtmosphereConfig(), atmosphereRequest, webSocket); webSocketProcessor.open(webSocket, atmosphereRequest, response); if (webSocketTimeout > 0) { webSocket.closeFuture(suspendTimer.scheduleAtFixedRate(() -> { if (webSocket.lastWriteTimeStampInMilliseconds() != 0 && (System.currentTimeMillis() - webSocket.lastWriteTimeStampInMilliseconds() > webSocketTimeout)) { logger.debug("Timing out {}", webSocket); webSocket.close(); } }, webSocketTimeout, webSocketTimeout, TimeUnit.MILLISECONDS)); } } } });
@Override public void operationComplete(ChannelFuture future) throws Exception { if (!future.isSuccess()) { future.channel().close(); } else { websocketChannels.add(ctx.channel()); ctx.channel().attr(ATTACHMENT).set(webSocket); if (config.noInternalAlloc()) { webSocket.resource(proxiedResource); } AtmosphereResponse response = config.noInternalAlloc() ? proxiedResponse : AtmosphereResponseImpl.newInstance(framework.getAtmosphereConfig(), atmosphereRequest, webSocket); webSocketProcessor.open(webSocket, atmosphereRequest, response); if (webSocketTimeout > 0) { webSocket.closeFuture(suspendTimer.scheduleAtFixedRate(() -> { if (webSocket.lastWriteTimeStampInMilliseconds() != 0 && (System.currentTimeMillis() - webSocket.lastWriteTimeStampInMilliseconds() > webSocketTimeout)) { logger.debug("Timing out {}", webSocket); webSocket.close(); } }, webSocketTimeout, webSocketTimeout, TimeUnit.MILLISECONDS)); } } } });
wsFactory.sendUnsupportedVersionResponse(ctx.channel()); } else { final NettyWebSocket webSocket = new NettyWebSocket(ctx.channel(), framework.getAtmosphereConfig(), config.noInternalAlloc(), config.binaryWrite()); final AtmosphereRequest atmosphereRequest = createAtmosphereRequest(ctx, request, EMPTY);
wsFactory.sendUnsupportedVersionResponse(ctx.channel()); } else { final NettyWebSocket webSocket = new NettyWebSocket(ctx.channel(), framework.getAtmosphereConfig(), config.noInternalAlloc(), config.binaryWrite()); final AtmosphereRequest atmosphereRequest = createAtmosphereRequest(ctx, request, EMPTY);
maxWebSocketFrameSize = config.maxWebSocketFrameSize(); if (config.noInternalAlloc()) { proxiedRequest = new AtmosphereRequestImpl.Builder().build(); proxiedResponse = new AtmosphereResponseImpl.Builder().build();
maxWebSocketFrameSize = config.maxWebSocketFrameSize(); if (config.noInternalAlloc()) { proxiedRequest = new AtmosphereRequestImpl.Builder().build(); proxiedResponse = new AtmosphereResponseImpl.Builder().build();