-
-
Notifications
You must be signed in to change notification settings - Fork 126
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 parameters are ignored when websocketProvider is set #659
Comments
Actually, now I realized that putting additional data into the |
I made an experiment today - I'm passing the additional data through the When I connect to a document using a token that has I have removed the logic of passing the |
hey @martindzejky, the parameters are passed as HTTP parameters, so it indeed doesn't work with multiplexing (as we share the connection, it would be using the same HTTP parameters for all documents). If you want to pass additional data, the recommendation would be to use a jwt token for authentication and pass the parameters in that. Using HTTP parameters for something like If you want to do this using server side auth with JWT, you'll need to destroy the old provider first, and then open a new provider. This will close the server connection and then allow the auth hook to run again. |
Thanks for the info 👍 . Regarding the provider, are you sure that is the way to go when I'm using multiplexing? When I need to close connection to a document and then reopen it using different data (which means different authentication token), I can't just destroy the provider because other documents and editors might still be using it. 🤔 |
Description
When creating a new
HocuspocusProvider
, if awebsocketProvider
is set, theparameters
are completely ignored:I'm not 100% sure whether this is a bug or it is intentional, given the implementation (config parameters are only used when creating a new provider):
hocuspocus/packages/provider/src/HocuspocusProvider.ts
Line 245 in 41de643
Steps to reproduce the bug
Steps to reproduce the behavior:
HocuspocusProviderWebsocket
HocuspocusProvider
and pass thewebsocketProvider
parameters
on the providerrequestParameters
are empty{}
Expected behavior
I would expect that I can pass request parameters separately for each document connection. The documentation is not fully clear how to use the providers in multiplexing so perhaps I'm not doing this correctly?
What I want to do is to pass extra data for a document connection, such as whether it should be in readonly mode or what template ID (a separate string) to use for the document. If
parameters
are not supposed to be used for this, then first - please update the docs to make this more clear - and second, how should I implement this? Should I just add this info into thename
? I.e.name: "${resourceId}?readOnly=${readOnly || false}&templateId=${collaborationTemplateId}"
Screenshot, video, or GIF
N/A
Environment?
v2.2.3
Additional context
N/A
The text was updated successfully, but these errors were encountered: