Description
To manually want to close the websocket provider connection to Hocuspocus, you can call provider.disconnect
However, subsequently calling provider.connect does not properly reconnect the provider instance to the websocket instance and send the edits over the wire.
This appears to have been introduced in #727
Context/Questions
We've long used provider.disconnect() when a TipTap client backgrounds their browser tab so that our Hocuspocus instance doesn't end up with dozens or more unused websocket connections open for long periods of time. When the tab is foregrounded again, we call provider.connect()
Is there a better way to achieve this behavior?
Steps to reproduce the bug
Steps to reproduce the behavior:
Setup a HocuspocusProvider instance
Connect to Hocuspocus Server
Make edits successfully
Invoke providerInstance.disconnect()
Wait a second
Invoke providerInstance.connect()
Make edits to document
Expected behavior
The edits are captured by the server
Actual behavior
The edits do not get sent
Environment?
Hocuspocus version: Since 2.7.0
Additional context
It appears you can workaround this by calling provider.configuration.websocket.attach(provider) instead (which calls provider.connect internally), but its a little yucky:
Description To manually want to close the websocket provider connection to Hocuspocus, you can call
provider.disconnect
However, subsequently calling
provider.connect
does not properly reconnect the provider instance to the websocket instance and send the edits over the wire.This appears to have been introduced in #727
Context/Questions
We've long used
provider.disconnect()
when a TipTap client backgrounds their browser tab so that our Hocuspocus instance doesn't end up with dozens or more unused websocket connections open for long periods of time. When the tab is foregrounded again, we callprovider.connect()
Is there a better way to achieve this behavior?
Steps to reproduce the bug Steps to reproduce the behavior:
providerInstance.disconnect()
providerInstance.connect()
Expected behavior The edits are captured by the server
Actual behavior The edits do not get sent
Environment?
Additional context It appears you can workaround this by calling
provider.configuration.websocket.attach(provider)
instead (which calls provider.connect internally), but its a little yucky:Possibly related to #594