-
-
Notifications
You must be signed in to change notification settings - Fork 263
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
Reconnected client becomes visible to others only after some period #122
Comments
@dmonad Also another issue is that on reconnection we can receive the current awareness state of others (e.g. https://github.com/yjs/y-websocket/blob/master/bin/utils.js#L278-L284). But their clocks could be still the same as we already have in |
That's a good point. Thank you, I'll look into this! |
Hey! Is there any way we can help with it? |
@dmonad could you please give any comment on this? |
@mifopen did you ever get this sorted? running into same issue |
also, @dmonad, the line in question in the if (currClock < clock || (currClock === clock && state === null && awareness.states.has(clientID))) {...} is also blocking us after a reconnection. I'm unable to get any updates through until the |
I mixed two issues into one, so let me explain our workarounds one by one. The one described in the starter post we are still fixing with provider.on('status', ({ status }) => {
if (status === 'connected') {
provider.awareness.setLocalState(provider.awareness.getLocalState());
}
}); So just an artificial clock ticking. Next regarding the one I added as a comment: |
@mifopen thanks! would love to see your implementation. for some reason, i am unable to get the clock to tick via settting |
Here's the patch to introduce resurrected nodes
|
Regarding empty |
Let's say we have two clients: 1 and 2 that synchronise their awareness states via some server node. They both have some states.
Now if we call
provider.disconnect()
on the second client then the first one will notice it immediately.But if we call
provider.connect()
then no event will raise on the awareness instance of the first one.added
,updated
,removed
arrays will be empty because of the following condition:In our case
currClock === clock
butstate
is not null and there is noclientID
instates
map because client was just removed from it after disconnecting.The problem as I can see it is that clock stays the same.
I applied the following workaround:
just to tick the clock but I think it makes sense to implement it inside y-websocket library
The text was updated successfully, but these errors were encountered: