socketio / engine.io-client-java

Engine.IO Client Library for Java
http://socketio.github.io/engine.io-client-java
Other
360 stars 167 forks source link

Cannot use a custom path #95

Closed kptdobe closed 3 years ago

kptdobe commented 7 years ago

When setting a custom path via the options, the request always contains an extra trailing / in the path.

IO.Options options = new IO.Options();
options.path = "/bin/engine.io";
Socket socket = IO.socket(uri, options);

will lead to the following request

http://myserver/bin/engine.io/?=&EIO=3&transport=polling

which is not supported on my server.

This code explicitly adds the trailing /: https://github.com/socketio/engine.io-client-java/blob/17dc5b4a608dfce3e9f37d2355d1a14b568cb26e/src/main/java/io/socket/engineio/client/Socket.java#L202

Is there any specific reason for that ? Can we consider this as a bug ? I can do a PR, change is easy but impact might be huge.

nkzawa commented 7 years ago

The trailing / is deliberate since engine.io sever also normalizes the path like that.

https://github.com/socketio/engine.io/blob/master/lib/server.js#L449

I wonder why it doesn't work on your environment. What versions of client and server do you use?

kptdobe commented 7 years ago

I use the socket.io client

https://github.com/socketio/socket.io-client-java

which is based on your engine. The server is our own made implementation of socket.io but the path is custom /bin/socket.io.

nkzawa commented 7 years ago

In that case, it'd be the easiest to fix your server since it's difficult to do this library.

darrachequesne commented 3 years ago

Closed due to inactivity, please reopen if needed.

IvanLotoff commented 3 years ago

what was the problem to delete this / in one place. It really makes a lot of problems. What if a person doesnt have access to backend. This / is useless, if a user needs it he can add it without your checks