public static synchronized void websocket ( String url , BiConsumer < WebSocketChannel , BufferedTextMessage > onMessage ) { checkStarted ( ) ; instance ( ) . endpoints . add ( HandlerUtil . websocket ( url , new WebsocketEndpoint ( ) { @ Override public void onConnect ( WebSocketHttpExchange exchange , WebSocketChannel channel ) { } @ Override protected void onFullTextMessage ( WebSocketChannel channel , BufferedTextMessage message ) throws IOException { onMessage . accept ( channel , message ) ; } } ) ) ; }
A simplified Websocket endpoint . Supports path variables