Is there any way to pass the source from server to clients?
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 6.5k
- Forks
- 456
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 5
Description
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?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the submitSource and "op batch" handling shown in client.ts and opSubmit.ts, then compare it with the documented submitOp source option. Verify whether the user-provided source reaches the client callback rather than being reported as false, and document or test the expected behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100