Skip to content

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

@common5

Description

@common5

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions