Skip to content
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

HocusPocusProvider V2 initiates 2 connections despite setting the connect flag to false #594

Open
ghost opened this issue Apr 29, 2023 · 3 comments
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@ghost
Copy link

ghost commented Apr 29, 2023

Description
The HocusPocusProvider initiates 2 connections to our YJS backend despite setting the connect flag (from v1) to true. It should set up 1 connection.

Steps to reproduce the bug
Steps to reproduce the behavior:

  1. Go to the examples in the repository https://github.com/BitPhinix/slate-yjs .
  2. Upgrade the hocuspocus version on both the client and the server.
  3. Open the client in a browser. And open the Network tab.
  4. You would see 2 connections established to the hocuspocus backend.

Expected behavior
A single connection should be formed between the client and the server.

Screenshot, video, or GIF
Screenshot 2023-04-29 at 11 56 52 PM

Environment?

  • operating system: MacBook Pro 2021 16 inch Apple M1 Max Ventura 13.3.1
  • browser: Brave
  • mobile/desktop: Desktop
  • Hocuspocus version: 2.0.6

Additional context
The problem seems to be in this line where the connect parameter is not passed to the configuration.:

parameters: websocketProviderConfig.parameters,

@ghost ghost added the bug Something isn't working label Apr 29, 2023
@ghost ghost assigned janthurau Apr 29, 2023
@janthurau
Copy link
Collaborator

@osamatanveer I've just added an example to the provider documentation. If you want to use multiplexing, you'll have to create the websocket separately from the provider (see https://tiptap.dev/hocuspocus/provider/examples#multiplexing).

@janthurau janthurau added documentation Improvements or additions to documentation and removed bug Something isn't working labels May 14, 2023
@ghost
Copy link
Author

ghost commented Jun 27, 2023

Thanks @janthurau. We're not trying to use multiplexing. It is just that when we connect using editor.connect() we see 2 web socket connection opened in the network tab. We still are facing this issue.

@svenadlung svenadlung reopened this Aug 4, 2023
@aonnikov
Copy link

The same issue for me, as a dirty workaround I disconnect the configured websocket provider in addition to the Hocuspocus provider:

        provider.configuration.websocketProvider.disconnect()
        provider.disconnect()

Looks dirty, but works fine to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

3 participants