code: 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);
  				}
  			});
  		}
  	}
docs: send the given object to the server using JSON serialization
  
  @param o the object to send to the server