jaxrs/src/main/java/de/taimos/dvalin/jaxrs/websocket/ServerJSONWebSocketAdapter.java
/**
     * send object to client and serialize it using JSON
     *
     * @param objectToSend  the object to send
     * @param cb the callback after sending the message
     */
send object to client and serialize it using JSON
@param objectToSend  the object to send
@param cb the callback after sending the message
send object to client and serialize it using JSON @param objectToSend the object to send @param cb the callback after sending the message
protected final void sendObjectToSocket(Object objectToSend, WriteCallback cb) {
        Session sess = this.getSession();
        if (sess != null) {
            String json;
            try {
                json = this.mapper.writeValueAsString(objectToSend);
            } catch (JsonProcessingException e) {
                throw new RuntimeException("Failed to serialize object", e);
            }
            sess.getRemote().sendString(json, cb);
        }
    }
protected final void sendObjectToSocket ( Object objectToSend , WriteCallback cb ) { Session sess = this . getSession ( ) ; if ( sess != null ) { String json ; try { json = this . mapper . writeValueAsString ( objectToSend ) ; } catch ( JsonProcessingException e ) { throw new RuntimeException ( "Failed to serialize object" , e ) ; } sess . getRemote ( ) . sendString ( json , cb ) ; } }
send object to client and serialize it using JSON
 @param objectToSend  the object to send
 @param cb the callback after sending the message
send object to client and serialize it using JSON @param objectToSend the object to send @param cb the callback after sending the message