-
Notifications
You must be signed in to change notification settings - Fork 453
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pass user information with the op to remote clients. #512
Comments
I think it might be possible to get this to work without any modifications. You're allowed to set an arbitrary ID on your connection = nw Connection(socket);
// Concat with a `uuid` in case the same user has multiple sessions, since
// the Connection ID should be unique per-connection
connection.id = [userId, uuid()].join(':'); Then in remote clients, on the doc.on('op', (op, source, src) => {
const [userId] = src.split(':');
// Do something with userId...
}); |
@alecgibson , thank you for a quick response! I will experiment with your suggestion and it may be good enough for now. I was using |
Yeah that's fair; I've long thought we should be able to facilitate getting op metadata to clients! |
Use case: Visually track change attribution across remote clients.
[#224] allows to store
metadata
, which containsuserId
, but falls short of pushingmetadata
out to remote clients.Proposed solution:
On a server side:
Retain backend constructor options in order to pass around
options.opsOptions
to configure metadata behavior.Include
message.m
in agent's_sendOp
based onbackend.options.opsOptions.metadata
configuration.Include
op.m
in SubmitRequest based onbackend.options.opsOptions.metadata
configuration.On a client side:
Emit
op.m
with everyop
related event.The text was updated successfully, but these errors were encountered: