Skip to content

Commit b7e9b76

Browse files
author
Vinay S Shenoy
committed
Added listener event for connecting to endpoints
1 parent e1877d6 commit b7e9b76

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/com/codebutler/android_websockets/SocketIOClient.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ public class SocketIOClient {
2525
public static interface Handler {
2626
public void onConnect();
2727

28+
public void onConnectToEndpoint(String endpoint);
29+
2830
public void on(String event, JSONArray arguments);
2931

3032
public void onDisconnect(int code, String reason);
@@ -142,7 +144,11 @@ public void onMessage(String message) {
142144
switch (code) {
143145
case 1:
144146
// connect
145-
mHandler.onConnect();
147+
if (!TextUtils.isEmpty(parts[2])) {
148+
mHandler.onConnectToEndpoint(parts[2]);
149+
} else {
150+
mHandler.onConnect();
151+
}
146152
break;
147153
case 2:
148154
// heartbeat

0 commit comments

Comments
 (0)