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

ServerBuilder does not correctly use 'wss' when used over https #59

Open
mofojed opened this issue Oct 22, 2024 · 1 comment
Open

ServerBuilder does not correctly use 'wss' when used over https #59

mofojed opened this issue Oct 22, 2024 · 1 comment

Comments

@mofojed
Copy link

mofojed commented Oct 22, 2024

There appears to be a bug in ServerBuilder:

urlBuilder.protocol = DomGlobal.self.location.protocol.equals("https") ? "wss": "ws";

Here it's checking if window.location.protocol == 'https'. However, the protocol property includes the colon, and returns 'https:'. This check is always false and so always reverts to ws for the protocol set.

See MDN page about location.protocol: https://developer.mozilla.org/en-US/docs/Web/API/Location/protocol

The protocol property of the Location interface is a string representing the protocol scheme of the URL, including the final ':'.

image
image

@niloc132
Copy link
Member

Thanks - I think this is best resolved by removing the default url entirely, so that ServerBuilder is compatible with non-browser JS environments?

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

No branches or pull requests

2 participants