@Override
public void onOpen(Session session, EndpointConfig ec) {
session.addMessageHandler(new MessageHandler.Whole<String>() {
@Override
public void onMessage(String message) {
final Snapshot current = deserialize(message);
Platform.runLater(() ->
snapshot.set(current));
}
});
}