Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import io.netty.channel.ChannelPipeline;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.SimpleChannelInboundHandler;
import io.netty.channel.nio.NioEventLoop;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.SocketChannel;
import io.netty.channel.socket.nio.NioSocketChannel;
import io.netty.handler.codec.http.FullHttpRequest;
Expand Down Expand Up @@ -182,7 +184,8 @@ protected void verify(FullHttpResponse response) {
}
}, connectFunction);

b.group(eventLoopGroup)

b.group(determineEventLoopGroup())
.channel(NioSocketChannel.class)
.handler(new ChannelInitializer<SocketChannel>() {
@Override
Expand Down Expand Up @@ -214,6 +217,15 @@ public void operationComplete(ChannelFuture future) throws Exception {
return handler.handshakeFuture;
}

// the bootstrap always uses NioSocketChannel, so we need to provide a proper NioEventLoopGroup
private EventLoopGroup determineEventLoopGroup() {
if (NioEventLoopGroup.class.equals(eventLoopGroup.getClass())) {
return eventLoopGroup;
}
// there is not much else we can do here...
return new NioEventLoopGroup();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, but it's unfortunate. We should add a note in the Quarkus documentation when using the legacy web socket implementation; native transport is not recommended.

}


private class WebSocketClientHandler<R> extends SimpleChannelInboundHandler<Object> {

Expand Down