title: Server sending a greeting message with websocket and netty -> causing exception
body: <p>I have a websocket server using Netty (4.0.17) that answers requests from a JavaScript client.
  The communication works fine but I have an exception when I try to immediately send a greeting message when a client connects.</p>
  
  <p>My code looks like that :</p>
  
  <pre><code>public class LiveOthelloWSHandler extends SimpleChannelInboundHandler&lt;TextWebSocketFrame&gt; {
  
      @Override
      public void channelActive(ChannelHandlerContext ctx) throws Exception {
          super.channelActive(ctx);
          ChannelFuture f = ctx.channel().writeAndFlush(new TextWebSocketFrame("(gameID=0)[LiveOthelloServer="+ VERSION_NUMBER + "]\n"));
      }
  
  // ...
  
      @Override
      protected void channelRead0(ChannelHandlerContext ctx, TextWebSocketFrame frame) throws Exception {
  
          final String request = frame.text();
          Channel thisChannel = ctx.channel();
  
          // Do something with request
          // Write back
  
          thisChannel.writeAndFlush(new TextWebSocketFrame(response + "\n"));
      }
  }
  </code></pre>
  
  <p>The <code>channelRead0()</code> is ok, the client sends messages and the server answers back without any issue.
  What doesn't work is the "greetings" part. I would like to send a welcoming message to the client (the string using <code>VERSION_NUMBER</code> in the <code>ChannelActive()</code> method) but I always get an exception :</p>
  
  <pre><code>java.lang.UnsupportedOperationException: unsupported message type: TextWebSocketFrame
  </code></pre>
  
  <p>I guess this is maybe because the <code>channelActive()</code> gets invoked as soon as the connection is established but before the websocket handshake is complete. How can I wait for the handshake to be finished and then send the greeting message (without the client having sent any request yet)?</p>
  
  <p>For information, my initialization is:</p>
  
  <pre><code>@Override
  public void initChannel(SocketChannel ch) throws Exception {
      ChannelPipeline pipeline = ch.pipeline();
      pipeline.addLast(
                       new HttpRequestDecoder(),
                       new HttpObjectAggregator(65536),
                       new HttpResponseEncoder(),
                       new WebSocketServerProtocolHandler("/websocket"),
                       myLiveOthelloWSHandler);
  </code></pre>