encodeAwarenessUpdate = (awareness, clients, states = awareness.states) => {
  const len = clients.length;
  const encoder = encoding.createEncoder();
  encoding.writeVarUint(encoder, len);

  for (let i = 0; i < len; i++) {
    const clientID = clients[i];
    const state = states.get(clientID) || null;
    const clock =
    /** @type {MetaClientState} */
    awareness.meta.get(clientID).clock;
    encoding.writeVarUint(encoder, clientID);
    encoding.writeVarUint(encoder, clock);
    encoding.writeVarString(encoder, JSON.stringify(state));
  }

  return encoding.toUint8Array(encoder);
}
@param {Awareness} awareness
@param {Array<number>} clients
@return {Uint8Array}