You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please save me some time and use the following template. In 90% of all issues I can't reproduce the problem because I don't know what exactly you are doing, in which environment, or which y-* version is responsible. Just use the following template even if you think the problem is obvious.
Checklist
Are you reporting a bug? Use github issues for bug reports and feature requests. For general questions, please use https://discuss.yjs.dev/
Describe the bug I use a rich text editor with collaborative editing named Textbus, it use yjs and y-websocket to complete collaborative function. I use this editor with y-websocket and deploy a y-websocket node server. Open the editor it will new WebsocketProvider. When more than two users edit together( A and B), it collaborate normally; when A user click v button, A user will disconnect the y-websocket and the editor will destroy, I call the provider.destroy() to disconnect the y-websocket at the same time, A user and B user disconnect the collaborative, but in the Browser console, I see the A and B still print the awareness info, the correct should B print A not. The provider.awareness is not destroy completely, it cause the two provider.awareness send the message to other user client when A user connect to the editor again. I call the provider.awareness.destroy() to close the awareness update, it should add this statement (provider.awareness.destroy()) in the provider.destroy() function or modify the awareness.off() function.
To Reproduce Steps to reproduce the behavior:
open the two different account with the same editor
Click a button and call provider.destroy() to disconnect the y-websocket connection.
Open console, you will see the provider.awareness is still send message.
When this editor is reconnect the y-websocket, it will exist two provider.awareness send message.
Expected behavior When user call the provider.destroy() the provider should be destroyed completely includes awareness.
Screenshots I'm sorry for this, due to the network limitation, I cannot provide the screenshots temporarily.
When the provider is destroyed, it doesn't destroy the awareness instance. This is the intended behavior because other parts of your software may rely on the awareness instance.
If the awareness changes (e.g. moving of a cursor), is still propagated over y-websocket after calling provider.destroy(), this would be a bug. But I don't think this is the case here.
If you do awarenes.on('update', () => { console.log('update') }), you will receive updates forever, unless you destroy the awareness instance. It's not bound to the provider instance.
Special case: the awareness instance is destroyed when the associated ydoc is destroyed.
You can also call awareness.destroy() manually, if that is something you want to do.
However, I don't want to destroy the awareness instance when provider.destroy is called, because other providers may still use the awareness instance. Awareness instances can be shared between providers.
Just make sure that you don't use old awareness instances. Alternatively, you can supply awareness as an option to the WebsocketProvider, so the instance doesn't change when you recreate the provider. See https://github.com/yjs/y-websocket/?tab=readme-ov-file#api
In any case, I recommend that you do provider.disconnect instead of provider.destroy and recreating a provider.
Checklist
Describe the bug I use a rich text editor with collaborative editing named Textbus, it use yjs and y-websocket to complete collaborative function. I use this editor with y-websocket and deploy a y-websocket node server. Open the editor it will new WebsocketProvider. When more than two users edit together( A and B), it collaborate normally; when A user click v button, A user will disconnect the y-websocket and the editor will destroy, I call the provider.destroy() to disconnect the y-websocket at the same time, A user and B user disconnect the collaborative, but in the Browser console, I see the A and B still print the awareness info, the correct should B print A not. The provider.awareness is not destroy completely, it cause the two provider.awareness send the message to other user client when A user connect to the editor again. I call the provider.awareness.destroy() to close the awareness update, it should add this statement (provider.awareness.destroy()) in the provider.destroy() function or modify the awareness.off() function.
To Reproduce Steps to reproduce the behavior:
Expected behavior When user call the provider.destroy() the provider should be destroyed completely includes awareness.
Screenshots I'm sorry for this, due to the network limitation, I cannot provide the screenshots temporarily.
Environment Information
Additional context Add any other context about the problem here.
Huly®: YJS-569
The text was updated successfully, but these errors were encountered: