-
Notifications
You must be signed in to change notification settings - Fork 355
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
Adding an option to avoid the added trailing slash to the path #694
Conversation
Signed-off-by: iifawzi <iifawzie@gmail.com>
Hi! Thanks for the pull request. I guess we would need the same option on the server side, right? See here: https://github.com/socketio/engine.io/blob/917d1d29e13f2e8f523c3738f6413f67b587aebe/lib/server.ts#L642-L647 Regarding your use case, I think the Microsoft bot framework exposes a classic WebSocket server, and not a Socket.IO one, so you won't be able to connect anyway. Or am I missing something? |
Hi @darrachequesne, regarding the server side, I think yes, I didn't notice that, we need to have that check there too. I will double confirm that, and work on creating a PR there as well, later today Regarding the framework, you're right. But don't you feel that having |
Hmm, I'm not really sure about the usefulness of this new option. If others could chime in... |
IMHO, the URI pattern that Microsoft uses is legitimate, and might be used by others as mentioned in socketio/socket.io-client#1550 and socketio/socket.io-client-swift#297. Why the backslash is added from the first place? Is there a specific need for it? |
I have the exact issue with the library. The network firewalls are stripping of trailing slashes resulting in socket connectivity problem. I would definately love this option. |
We're currently having issues with this in our application. Lots of proxies and frontend libraries (Next.js, http-proxy) strip the trailing slash for all URLs that get rewritten, which results in Socket.io specifically not working. Having an option to disable the trailing slash, or better yet just making it so setting |
Hi @darrachequesne, would really appreciate it, if you can take another look here. |
The "addTrailingSlash" option allows to control whether a trailing slash is added to the path of the HTTP requests created by the library: - true (default): "/engine.io/" - false: "/engine.io" Related: socketio/socket.io-client#1550 Signed-off-by: iifawzi <iifawzie@gmail.com>
Merged as 21a6e12. Thanks 👍 |
Signed-off-by: iifawzi iifawzie@gmail.com
Hi, this PR is adding an option to avoid the added trailing slash to the path in the connection
Resolving socketio/socket.io-client#1550.
An example of a use case for this is the Microsoft bot framework stream URL:
Reconnect to a conversation in Direct Line API 3.0
I needed to use the native WebSocket since the
engine.io-client
is always adding a trailing slash afterstream
which broke the URI and hence the connection.Having this as an optional option would solve such use cases.
Current behaviour
a trailing slash is always added to the
path
.New behaviour
a trailing slash is still added to the
path
, but can be avoided by setting thetrailingSlash
option to false.