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

Document new WebsocketProvider usage vs WebsocketPolyfill #582

Open
georeith opened this issue Apr 20, 2023 · 2 comments
Open

Document new WebsocketProvider usage vs WebsocketPolyfill #582

georeith opened this issue Apr 20, 2023 · 2 comments
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@georeith
Copy link
Collaborator

WebsocketPolyfill was previously used to pass a websocket polyfill for NodeJS. Now it seems to have been superseded by websocketProvider however this is undocumented.

Looking at the code I notice that url and parameters are now ignored by HocuspocusProvider when you pass a custom websocketProvider and should be passed directly to it.

Would be helpful to document the intended usage of websocketProvider, and perhaps consider bringing back the ability to polyfill Websocket without the additional configuration changes.

@georeith georeith added the documentation Improvements or additions to documentation label Apr 20, 2023
@janthurau
Copy link
Collaborator

hey @georeith, HocuspocusProvider will still accept url and parameters if there is no websocketProvider passed, but then it will just create its own HOcuspocusProviderWebsocket. I implemented this for easier migration.

If you want to pass a polyfill, you can just pass a websocketProvider to Hocuspocusprovider:

const socket = new HocuspocusProviderWebsocket({WebSocketPolyfill: polyfill})
const provider = new HocuspocusProvider({ providerWebsocket: socket})

All methods related to the connection itself have been moved to the websocket, so we can't just pass a polyfill to the provider.

@georeith
Copy link
Collaborator Author

georeith commented Apr 23, 2023

hey @georeith, HocuspocusProvider will still accept url and parameters if there is no websocketProvider passed, but then it will just create its own HOcuspocusProviderWebsocket. I implemented this for easier migration.

If you want to pass a polyfill, you can just pass a websocketProvider to Hocuspocusprovider:

const socket = new HocuspocusProviderWebsocket({WebSocketPolyfill: polyfill})
const provider = new HocuspocusProvider({ providerWebsocket: socket})

All methods related to the connection itself have been moved to the websocket, so we can't just pass a polyfill to the provider.

Thanks @janthurau, I had worked out how to use it but think it should be documented that url and params need to be passed directly to it when you do as I had to reverse engineer the code to find that info.

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

2 participants