private void handleWebSocketFrame ( ChannelHandlerContext ctx , WebSocketFrame frame ) { if ( frame instanceof CloseWebSocketFrame ) { this . handshaker . close ( ctx . channel ( ) , ( CloseWebSocketFrame ) frame . retain ( ) ) ; CompletableFuture . completedFuture ( new WebSocketContext ( this . session , this . handler ) ) . thenAcceptAsync ( this . handler :: onDisConnect ) ; return ; } if ( frame instanceof PingWebSocketFrame ) { ctx . channel ( ) . write ( new PongWebSocketFrame ( frame . content ( ) . retain ( ) ) ) ; return ; } if ( ! ( frame instanceof TextWebSocketFrame ) ) { throw new UnsupportedOperationException ( "unsupported frame type: " + frame . getClass ( ) . getName ( ) ) ; } CompletableFuture . completedFuture ( new WebSocketContext ( this . session , this . handler , ( ( TextWebSocketFrame ) frame ) . text ( ) ) ) . thenAcceptAsync ( this . handler :: onText , ctx . executor ( ) ) ; }
Only supported TextWebSocketFrame