Skip to content
This repository was archived by the owner on Sep 6, 2020. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,19 @@ SocketIOClient client = new SocketIOClient(URI.create("wss://example.com"), new
public void on(String event, JSONArray arguments) {
Log.d(TAG, String.format("Got event %s: %s", event, arguments.toString()));
}

@Override
public void onJSON(JSONObject json) {
try {
Log.d(TAG, String.format("Got JSON Object: %s", json.toString()));
} catch(JSONException e) {
}
}

@Override
public void onMessage(String message) {
Log.d(TAG, String.format("Got message: %s", message));
}

@Override
public void onDisconnect(int code, String reason) {
Expand All @@ -82,12 +95,14 @@ SocketIOClient client = new SocketIOClient(URI.create("wss://example.com"), new
client.connect();

// Later…
client.emit("Message"); //Message
JSONArray arguments = new JSONArray();
arguments.put("first argument");
JSONObject second = new JSONObject();
second.put("dictionary", true);
client.emit(second); //JSON Message
arguments.put(second);
client.emit("hello", arguments);
client.emit("hello", arguments); //Event
client.disconnect();
```

Expand Down