private void send ( final String serviceName , final String message , final Consumer < Exception > exceptionConsumer ) { if ( webSocket == null ) { String webSocketURI ; if ( serviceName . startsWith ( uri ) ) { webSocketURI = serviceName ; } else { webSocketURI = Str . add ( uri , "/" , serviceName ) ; } this . webSocket = httpServerProxy . createWebSocket ( webSocketURI ) ; wireWebSocket ( serviceName , message ) ; } try { if ( webSocket . isClosed ( ) && connected ( ) ) { this . webSocket . openAndNotify ( netSocket -> { connected . set ( true ) ; webSocket . sendText ( message , exceptionConsumer ) ; } , exceptionConsumer ) ; } else { webSocket . sendText ( message ) ; } } catch ( Exception ex ) { this . connected . set ( false ) ; if ( debug ) throw ex ; } }
Sends a message over websocket .