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 ();
@@ -195,7 +195,7 @@ public void connect() {
195195 return ;
196196 new Thread () {
197197 public void run () {
198- HttpPost post = new HttpPost (mURI . toString () + "/socket.io/1/" );
198+ HttpPost post = new HttpPost (mURL );
199199 try {
200200 String line = downloadUriAsString (post );
201201 String [] parts = line .split (":" );
@@ -224,3 +224,4 @@ public void run() {
224224 }.start ();
225225 }
226226}
227+
You can’t perform that action at this time.
0 commit comments