File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
src/com/codebutler/android_websockets Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -30,15 +30,15 @@ public static interface Handler {
3030 public void onError (Exception error );
3131 }
3232
33- URI mURI ;
33+ String mURL ;
3434 Handler mHandler ;
3535 String mSession ;
3636 int mHeartbeat ;
37- int mClosingTimeout ;
3837 WebSocketClient mClient ;
3938
4039 public SocketIOClient (URI uri , Handler handler ) {
41- mURI = uri ;
40+ // remove trailing "/" from URI, in case user provided e.g. http://test.com/
41+ mURL = uri .toString ().replaceAll ("/$" , "" ) + "/socket.io/1/" ;
4242 mHandler = handler ;
4343 }
4444
@@ -86,7 +86,7 @@ public void run() {
8686 }
8787
8888 private void connectSession () throws URISyntaxException {
89- mClient = new WebSocketClient (new URI (mURI . toString () + "/socket.io/1/ websocket/" + mSession ), new WebSocketClient .Handler () {
89+ mClient = new WebSocketClient (new URI (mURL + "websocket/" + mSession ), new WebSocketClient .Handler () {
9090 @ Override
9191 public void onMessage (byte [] data ) {
9292 cleanup ();
@@ -200,7 +200,7 @@ public void connect() {
200200 return ;
201201 new Thread () {
202202 public void run () {
203- HttpPost post = new HttpPost (mURI . toString () + "/socket.io/1/" );
203+ HttpPost post = new HttpPost (mURL );
204204 try {
205205 String line = downloadUriAsString (post );
206206 String [] parts = line .split (":" );
@@ -229,3 +229,4 @@ public void run() {
229229 }.start ();
230230 }
231231}
232+
You can’t perform that action at this time.
0 commit comments