diff --git a/README.md b/README.md index 7425c42..0667347 100644 --- a/README.md +++ b/README.md @@ -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) { @@ -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(); ```