jaxrs/src/main/java/de/taimos/dvalin/jaxrs/websocket/ClientSocketAdapter.java
/**
     * send the given object to the server using JSON serialization
     *
     * @param o the object to send to the server
     */
send the given object to the server using JSON serialization
@param o the object to send to the server
send the given object to the server using JSON serialization @param o the object to send to the server
public final void sendObjectToSocket(Object o) {
        Session sess = this.getSession();
        if (sess != null) {
            String json;
            try {
                json = this.mapper.writeValueAsString(o);
            } catch (JsonProcessingException e) {
                ClientSocketAdapter.LOGGER.error("Failed to serialize object", e);
                return;
            }
            sess.getRemote().sendString(json, new WriteCallback() {
                @Override
                public void writeSuccess() {
                    ClientSocketAdapter.LOGGER.info("Send data to socket");
                }
                @Override
                public void writeFailed(Throwable x) {
                    ClientSocketAdapter.LOGGER.error("Error sending message to socket", x);
                }
            });
        }
    }
public final void sendObjectToSocket ( Object o ) { Session sess = this . getSession ( ) ; if ( sess != null ) { String json ; try { json = this . mapper . writeValueAsString ( o ) ; } catch ( JsonProcessingException e ) { ClientSocketAdapter . LOGGER . error ( "Failed to serialize object" , e ) ; return ; } sess . getRemote ( ) . sendString ( json , new WriteCallback ( ) { @ Override public void writeSuccess ( ) { ClientSocketAdapter . LOGGER . info ( "Send data to socket" ) ; } @ Override public void writeFailed ( Throwable x ) { ClientSocketAdapter . LOGGER . error ( "Error sending message to socket" , x ) ; } } ) ; } }
send the given object to the server using JSON serialization
 @param o the object to send to the server
send the given object to the server using JSON serialization @param o the object to send to the server