onSendUpdateToClient method

void onSendUpdateToClient(
  1. String js
)

Implementation

void onSendUpdateToClient(String js) {
  final parsed = jsonDecode(js) as Map;
  try {
    final documentID = parsed["documentID"];

    final doc = _documents[documentID];
    if (doc != null) {
      doc.receiveChanges(parsed["data"]);
    } else {
      throw Exception("Document is not registered $documentID");
    }
  } catch (err, stack) {
    Logger.root.log(Level.WARNING, "error: $err $stack");
  }
}