From f440715a972dd260ca5438f3e7e74ab5fcbc0375 Mon Sep 17 00:00:00 2001 From: Vinay S Shenoy Date: Sat, 2 Mar 2013 09:48:02 +0530 Subject: [PATCH 1/2] Update README.md --- README.md | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7425c42..72ce59a 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(); +client.emit(second); //JSON Message second.put("dictionary", true); arguments.put(second); -client.emit("hello", arguments); +client.emit("hello", arguments); //Event client.disconnect(); ``` From fc5d02338e63f6c977ec8dae8a019b272232e2f2 Mon Sep 17 00:00:00 2001 From: Vinay S Shenoy Date: Sat, 2 Mar 2013 09:50:37 +0530 Subject: [PATCH 2/2] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 72ce59a..0667347 100644 --- a/README.md +++ b/README.md @@ -99,8 +99,8 @@ client.emit("Message"); //Message JSONArray arguments = new JSONArray(); arguments.put("first argument"); JSONObject second = new JSONObject(); -client.emit(second); //JSON Message second.put("dictionary", true); +client.emit(second); //JSON Message arguments.put(second); client.emit("hello", arguments); //Event client.disconnect();