/** * @deprecated use {@link #sendUnsupportedVersionResponse(Channel)} */ @Deprecated public static void sendUnsupportedWebSocketVersionResponse(Channel channel) { sendUnsupportedVersionResponse(channel); }
/** * Return that we need cannot not support the web socket version */ public static ChannelFuture sendUnsupportedVersionResponse(Channel channel) { return sendUnsupportedVersionResponse(channel, channel.newPromise()); }
private void handshake(ChannelHandlerContext ctx, final UUID sessionId, String path, FullHttpRequest req) { final Channel channel = ctx.channel(); WebSocketServerHandshakerFactory factory = new WebSocketServerHandshakerFactory(getWebSocketLocation(req), null, true, configuration.getMaxFramePayloadLength()); WebSocketServerHandshaker handshaker = factory.newHandshaker(req); if (handshaker != null) { ChannelFuture f = handshaker.handshake(channel, req); f.addListener(new ChannelFutureListener() { @Override public void operationComplete(ChannelFuture future) throws Exception { if (!future.isSuccess()) { log.error("Can't handshake " + sessionId, future.cause()); return; } channel.pipeline().addBefore(SocketIOChannelInitializer.WEB_SOCKET_TRANSPORT, SocketIOChannelInitializer.WEB_SOCKET_AGGREGATOR, new WebSocketFrameAggregator(configuration.getMaxFramePayloadLength())); connectClient(channel, sessionId); } }); } else { WebSocketServerHandshakerFactory.sendUnsupportedVersionResponse(ctx.channel()); } }
private void upgradeChannel(final ChannelHandlerContext ctx, FullHttpRequest httpRequest) { handshaker = new WebSocketServerHandshakerFactory( "ws://" + httpRequest.headers().get(HOST) + UPGRADE_CHANNEL_FOR_UI_WEB_SOCKET_URI, null, true, Integer.MAX_VALUE ).newHandshaker(httpRequest); if (handshaker == null) { WebSocketServerHandshakerFactory.sendUnsupportedVersionResponse(ctx.channel()); } else { handshaker.handshake( ctx.channel(), httpRequest, new DefaultHttpHeaders(), ctx.channel().newPromise() ).addListener(new ChannelFutureListener() { @Override public void operationComplete(ChannelFuture future) throws Exception { clientRegistry.put(ctx, request()); } }); } }
).newHandshaker(httpRequest); if (handshaker == null) { WebSocketServerHandshakerFactory.sendUnsupportedVersionResponse(ctx.channel()); } else { final String clientId = UUID.randomUUID().toString();
private void handleHttpRequest(ChannelHandlerContext ctx, HttpRequest req) { if (isWebSocketRequest(req)) { WebSocketServerHandshakerFactory wsFactory = new WebSocketServerHandshakerFactory(req.uri(), null, true); this.handshaker = wsFactory.newHandshaker(req); if (this.handshaker == null) { //Return that we need cannot not support the web socket version WebSocketServerHandshakerFactory.sendUnsupportedVersionResponse(ctx.channel()); } else { this.handshaker.handshake(ctx.channel(), req); this.context = new WebSocketContext(ctx); this.uri = req.uri(); initHandlerWrapper(); this.handler.onConnect(this.context); } } else { ReferenceCountUtil.retain(req); ctx.fireChannelRead(req); } }
private void handleHttpRequest(ChannelHandlerContext ctx, HttpRequest req) { if (isWebSocketRequest(req)) { WebSocketServerHandshakerFactory wsFactory = new WebSocketServerHandshakerFactory(req.uri(), null, true); this.handshaker = wsFactory.newHandshaker(req); if (this.handshaker == null) { //Return that we need cannot not support the web socket version WebSocketServerHandshakerFactory.sendUnsupportedVersionResponse(ctx.channel()); } else { this.handshaker.handshake(ctx.channel(), req); this.context = new WebSocketContext(ctx); this.uri = req.uri(); initHandlerWrapper(); this.handler.onConnect(this.context); } } else { ReferenceCountUtil.retain(req); ctx.fireChannelRead(req); } }
final WebSocketServerHandshaker handshaker = wsFactory.newHandshaker(req); if (handshaker == null) { WebSocketServerHandshakerFactory.sendUnsupportedVersionResponse(ctx.channel()); } else { final ChannelFuture handshakeFuture = handshaker.handshake(ctx.channel(), req);
if (shake == null) { WebSocketServerHandshakerFactory.sendUnsupportedVersionResponse(ch);
return WebSocketServerHandshakerFactory.sendUnsupportedVersionResponse(channel); } else { return handshaker.handshake(
handshaker = wsFactory.newHandshaker(req); if (handshaker == null) { WebSocketServerHandshakerFactory.sendUnsupportedVersionResponse(ctx.channel()); } else { handshaker.handshake(ctx.channel(), req);
if (shake == null) { WebSocketServerHandshakerFactory.sendUnsupportedVersionResponse(ch);
/** * @deprecated use {@link #sendUnsupportedVersionResponse(Channel)} */ @Deprecated public static void sendUnsupportedWebSocketVersionResponse(Channel channel) { sendUnsupportedVersionResponse(channel); }
/** * @deprecated use {@link #sendUnsupportedVersionResponse(Channel)} */ @Deprecated public static void sendUnsupportedWebSocketVersionResponse(Channel channel) { sendUnsupportedVersionResponse(channel); }
/** * @deprecated use {@link #sendUnsupportedVersionResponse(Channel)} */ @Deprecated public static void sendUnsupportedWebSocketVersionResponse(Channel channel) { sendUnsupportedVersionResponse(channel); }
/** * @deprecated use {@link #sendUnsupportedVersionResponse(Channel)} */ @Deprecated public static void sendUnsupportedWebSocketVersionResponse(Channel channel) { sendUnsupportedVersionResponse(channel); }
/** * Return that we need cannot not support the web socket version */ public static ChannelFuture sendUnsupportedVersionResponse(Channel channel) { return sendUnsupportedVersionResponse(channel, channel.newPromise()); }
/** * Return that we need cannot not support the web socket version */ public static ChannelFuture sendUnsupportedVersionResponse(Channel channel) { return sendUnsupportedVersionResponse(channel, channel.newPromise()); }
/** * Return that we need cannot not support the web socket version */ public static ChannelFuture sendUnsupportedVersionResponse(Channel channel) { return sendUnsupportedVersionResponse(channel, channel.newPromise()); }
/** * Return that we need cannot not support the web socket version */ public static ChannelFuture sendUnsupportedVersionResponse(Channel channel) { return sendUnsupportedVersionResponse(channel, channel.newPromise()); }