ITADN

Is there any way to pass the source from server to clients?

#694Opencommon5 创建于 2025-04-20
C
common5commented
I've read the docs and found that I can pass some info to server by adding options.source in submitOp(), but how can a client get source from server? My code looks like: ` // client.ts doc.submitSource = true; doc.on("op batch", async (op, source) => { console.log(source); } // opSubmit.ts doc.submitSource = true; let op: { p: [string, number]; sd?: string; si?: string }[] = []; op.push({ p: ["content", offset], si: insertPosition}); doc.submitOp(op, {source: userId}); // userId is defined as string type, and I'm pretty sure I've passed a not-empty string value to it ` However, the source output in client.ts turns out to be false(a boolean value). Are there any possible solutions I may try to make the codes work as I've expected?
1 条评论