I'm trying to create a fairly simple WebSocket server using Netty 4.0.8. I have the basic handshake set up and working. But messages sent from a separate thread don't seem to be coming through to the client.
The way the client/server interaction works is that the client initiates the connection and then sends an initial message ("hello") over the WebSocket. The server responds immediately. This message comes through and is visible in the Chrome Dev Tools. After this message is written, I store the Channel
in a ChannelGroup
. This ChannelGroup
is initialized like this:
this.broadcastGroup = new NioEventLoopGroup();
this.group = new DefaultChannelGroup("websocket", broadcastGroup.next());
and then the Channel
is added like this:
group.add(ctx.channel());
In a separate thread (created outside of Netty), I do:
group.write(new TextWebSocketFrame("text"));
However, this message never appears in the Chrome Dev Tools.
I've tried debugging and I can see that when group.write()
is called, the original Channel
is in the group, but that's as far as I can get.