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

Feat: Implement websocketOptions as arg to CS connection #58

Merged
merged 4 commits into from
Dec 18, 2024

Conversation

carloslibardo
Copy link
Contributor

WHY

We need to pass CP password at websocket connection to CS.

HOW

Websocket connection has options parameters that allow to pass some configs as auth.

@carloslibardo carloslibardo merged commit b9ee039 into main Dec 18, 2024
2 checks passed
const url = `${this.csUrl}/${this.id}`;
const socket = new WebSocket(url, SUPPORTED_PROTOCOLS);
const socket = new WebSocket(url, SUPPORTED_PROTOCOLS, {
auth: `${this.id}:${connectArgs?.auth}`,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this always sets the auth key, which may not be desirable for other users of this library. I suggest moving this to the layer above, and just pass the connectArgs to the WebSocket constructor, that way it won't break any existing code

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

Successfully merging this pull request may close these issues.

3 participants