use of io.netty.handler.codec.http.HttpHeaders.Names.HOST in project modules-extra by CubeEngine.
the class WebSocketRequestHandler method doHandshake.
public void doHandshake(ChannelHandlerContext ctx, FullHttpRequest message) {
WebSocketServerHandshakerFactory handshakerFactory = new WebSocketServerHandshakerFactory("ws://" + message.headers().get(HOST) + "/" + WEBSOCKET_ROUTE, null, false);
this.handshaker = handshakerFactory.newHandshaker(message);
if (handshaker == null) {
this.log.info("client is incompatible!");
WebSocketServerHandshakerFactory.sendUnsupportedVersionResponse(ctx.channel());
return;
}
this.log.debug("handshaking now...");
this.handshaker.handshake(ctx.channel(), message).addListener((ChannelFutureListener) future -> {
if (future.isSuccess()) {
log.debug("Success!");
} else {
log.debug("Failed!");
}
});
}
Aggregations