//~--- methods --------------------------------------------------------
@Override
public void processMessage(WebSocketMessage webSocketData) {
final AbstractNode node = getNode(webSocketData.getId());
Map<String, Object> properties = webSocketData.getNodeData();
String patch = (String) properties.get("patch");
if (node != null) {
diff_match_patch dmp = new diff_match_patch();
String oldText = node.getProperty(Content.content);
LinkedList<Patch> patches = (LinkedList<Patch>) dmp.patch_fromText(patch);
final Object[] results = dmp.patch_apply(patches, oldText);
try {
node.setProperty(Content.content, results[0].toString());
} catch (Throwable t) {
logger.log(Level.WARNING, "Could not apply patch {0}", patch);
getWebSocket().send(MessageBuilder.status().code(400).message("Could not apply patch. " + t.getMessage()).build(), true);