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

Root URL without trailing slash leads to %WebSockex.ConnError{original: :closed}) #102

Open
ftes opened this issue Nov 29, 2021 · 1 comment

Comments

@ftes
Copy link

ftes commented Nov 29, 2021

How to reproduce

WebSockex.start_link("ws://localhost", __MODULE__, nil)
Error: reason: %WebSockex.ConnError{original: :closed}

Expected behaviour

The connection should be established with and without a trailing slash.

This works: WebSockex.start_link("ws://localhost", ...
This works: WebSockex.start_link("ws://localhost/not-root", ...

Remarks

Maybe this is an issue of my websocket server, rather than the WebSockex client?

However, the connection can be established by a different websocket client (Firefox weasel plugin).
Looking at the network trace of that plugin, it looks like it adds the trailing slash automatically in the HTTP request if it was not explicitly provided. Could that be a sensible approach for WebSockex as well?

@ftes
Copy link
Author

ftes commented Nov 29, 2021

From a brief look at the weasel source I couldn't find any "add a trailing /" logic.
Probably the browser adds / as the default path.

@ftes ftes changed the title URL without trailing slash leads to %WebSockex.ConnError{original: :closed}) Root URL without trailing slash leads to %WebSockex.ConnError{original: :closed}) Nov 29, 2021
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

1 participant