From 4204c3ba89b2d8d7390c8ae9857da4eb1f41c84a Mon Sep 17 00:00:00 2001 From: "Enno Boland (Gottox)" Date: Tue, 28 Feb 2012 15:07:00 +0100 Subject: [PATCH 01/29] merge was wrong, correcting --- build.xml | 3 ++- src/io/socket/IOConnection.java | 19 +++++++++++-------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/build.xml b/build.xml index b8fc082..9496a4b 100644 --- a/build.xml +++ b/build.xml @@ -16,7 +16,7 @@ - + @@ -91,6 +91,7 @@ + diff --git a/src/io/socket/IOConnection.java b/src/io/socket/IOConnection.java index 1dc8c06..578581e 100644 --- a/src/io/socket/IOConnection.java +++ b/src/io/socket/IOConnection.java @@ -21,6 +21,7 @@ import java.util.Timer; import java.util.TimerTask; import java.util.concurrent.ConcurrentLinkedQueue; +import java.util.logging.Logger; import org.json.JSONArray; import org.json.JSONException; @@ -31,6 +32,8 @@ * The Class IOConnection. */ class IOConnection { + /** Debug logger */ + static final Logger logger = Logger.getLogger("io.socket"); /** The Constant STATE_INIT. */ private static final int STATE_INIT = 0; @@ -375,7 +378,7 @@ private void cleanup() { transport.disconnect(); sockets.clear(); connections.remove(urlStr); - System.out.println("Cleanup"); + logger.info("Cleanup"); backgroundTimer.cancel(); } @@ -406,10 +409,10 @@ private void sendPlain(String text) { synchronized (outputBuffer) { if (getState() == STATE_READY) try { - System.out.println("> " + text); + logger.info("> " + text); transport.send(text); } catch (Exception e) { - System.out.println("IOEx: saving"); + logger.info("IOEx: saving"); outputBuffer.add(text); } else { @@ -458,11 +461,11 @@ public void transportConnected() { // DEBUG String[] texts = outputBuffer .toArray(new String[outputBuffer.size()]); - System.out.println("Bulk start:"); + logger.info("Bulk start:"); for (String text : texts) { - System.out.println("> " + text); + logger.info("> " + text); } - System.out.println("Bulk end"); + logger.info("Bulk end"); // DEBUG END transport.sendBulk(texts); } catch (IOException e) { @@ -508,7 +511,7 @@ public void transportError(Exception error) { * been received. */ public void transportMessage(String text) { - System.out.println("< " + text); + logger.info("< " + text); IOMessage message; try { message = new IOMessage(text); @@ -712,7 +715,7 @@ public String getSessionId() { /** A dummy callback used when IOConnection receives a unexpected message. */ final static public IOCallback DUMMY_CALLBACK = new IOCallback() { private void out(String msg) { - System.out.println("DUMMY CALLBACK: " + msg); + logger.info("DUMMY CALLBACK: " + msg); } @Override From 8909ee9234bf585f6d8cfcd17486e8506106a6f4 Mon Sep 17 00:00:00 2001 From: "Enno Boland (Gottox)" Date: Tue, 28 Feb 2012 17:25:06 +0100 Subject: [PATCH 02/29] IOConnection: does not throw an exception when event contains no args --- src/io/socket/IOConnection.java | 44 ++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/src/io/socket/IOConnection.java b/src/io/socket/IOConnection.java index 578581e..1fd2ef6 100644 --- a/src/io/socket/IOConnection.java +++ b/src/io/socket/IOConnection.java @@ -231,17 +231,16 @@ private void handshake() { */ static public IOConnection register(String origin, SocketIO socket) { List list = connections.get(origin); - if(list == null) { + if (list == null) { list = new LinkedList(); connections.put(origin, list); - } - else { - for(IOConnection connection : list) { - if(connection.register(socket)) + } else { + for (IOConnection connection : list) { + if (connection.register(socket)) return connection; } } - + IOConnection connection = new IOConnection(origin, socket); list.add(connection); return connection; @@ -352,9 +351,11 @@ protected void error(SocketIOException e) { /** * Connects a socket to the IOConnection. - * - * @param socket the socket to be connected - * @return true, if successfully registered on this transport, otherwise false. + * + * @param socket + * the socket to be connected + * @return true, if successfully registered on this transport, otherwise + * false. */ public boolean register(SocketIO socket) { String namespace = socket.getNamespace(); @@ -588,11 +589,14 @@ public void transportMessage(String text) { case IOMessage.TYPE_EVENT: try { JSONObject event = new JSONObject(message.getData()); - JSONArray args = event.getJSONArray("args"); - Object[] argsArray = new Object[args.length()]; - for (int i = 0; i < args.length(); i++) { - if (args.isNull(i) == false) - argsArray[i] = args.get(i); + Object[] argsArray = new Object[0]; + if (event.has("args")) { + JSONArray args = event.getJSONArray("args"); + argsArray = new Object[args.length()]; + for (int i = 0; i < args.length(); i++) { + if (args.isNull(i) == false) + argsArray[i] = args.get(i); + } } String eventName = event.getString("name"); try { @@ -705,8 +709,7 @@ private void warning(String message) { /** * Returns the session id. This should be called from a {@link IOTransport} * - * @return the session id to connect to the right - * Session. + * @return the session id to connect to the right Session. */ public String getSessionId() { return sessionId; @@ -827,7 +830,7 @@ public boolean isConnected() { /** * Gets the current state of this IOConnection. - * + * * @return current state */ private synchronized int getState() { @@ -836,8 +839,9 @@ private synchronized int getState() { /** * Sets the current state of this IOConnection. - * - * @param state the new state + * + * @param state + * the new state */ private synchronized void setState(int state) { this.state = state; @@ -845,7 +849,7 @@ private synchronized void setState(int state) { /** * gets the currently used transport. - * + * * @return currently used transport */ public IOTransport getTransport() { From fec51c17b18e0f71e0afe6eaf44f33fe86632fd5 Mon Sep 17 00:00:00 2001 From: "Enno Boland (Gottox)" Date: Tue, 28 Feb 2012 17:29:53 +0100 Subject: [PATCH 03/29] IOConnection: small rearrangement --- src/io/socket/IOConnection.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/io/socket/IOConnection.java b/src/io/socket/IOConnection.java index 1fd2ef6..3dad11c 100644 --- a/src/io/socket/IOConnection.java +++ b/src/io/socket/IOConnection.java @@ -275,9 +275,9 @@ else if (protocols.contains(XhrTransport.TRANSPORT_NAME)) * server doesn't request one. */ private IOAcknowledge remoteAcknowledge(IOMessage message) { - if (message.getId().endsWith("+") == false) - return null; final String id = message.getId(); + if (id.endsWith("+") == false) + return null; final String endPoint = message.getEndpoint(); return new IOAcknowledge() { @Override From b016348b6b252775aba2b6460e4f78cb9d3044d0 Mon Sep 17 00:00:00 2001 From: "Enno Boland (Gottox)" Date: Tue, 28 Feb 2012 18:18:46 +0100 Subject: [PATCH 04/29] Make server side acknowledgements work again. --- src/io/socket/IOConnection.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/io/socket/IOConnection.java b/src/io/socket/IOConnection.java index 3dad11c..3727e94 100644 --- a/src/io/socket/IOConnection.java +++ b/src/io/socket/IOConnection.java @@ -275,9 +275,12 @@ else if (protocols.contains(XhrTransport.TRANSPORT_NAME)) * server doesn't request one. */ private IOAcknowledge remoteAcknowledge(IOMessage message) { - final String id = message.getId(); - if (id.endsWith("+") == false) + String _id = message.getId(); + if (_id.equals("")) return null; + else if(_id.endsWith("+") == false) + _id = _id+"+"; + final String id = _id; final String endPoint = message.getEndpoint(); return new IOAcknowledge() { @Override @@ -291,7 +294,6 @@ public void ack(Object... args) { "You can only put values in IOAcknowledge.ack() which can be handled by JSONArray.put()", e)); } - } IOMessage ackMsg = new IOMessage(IOMessage.TYPE_ACK, endPoint, id + array.toString()); @@ -312,7 +314,7 @@ private void synthesizeAck(IOMessage message, IOAcknowledge ack) { if (ack != null) { int id = nextId++; acknowledge.put(id, ack); - message.setId(id + "+"); + message.setId(id+"+"); } } @@ -579,7 +581,7 @@ public void transportMessage(String text) { remoteAcknowledge(message)); } catch (Exception e) { error(new SocketIOException( - "Exception was thrown in onMessage(JSONObject)\n" + "Exception was thrown in onMessage(JSONObject).\n" + "Message was: " + message.toString(), e)); } } catch (JSONException e) { @@ -604,7 +606,7 @@ public void transportMessage(String text) { remoteAcknowledge(message), argsArray); } catch (Exception e) { error(new SocketIOException( - "Exception was thrown in on(String, JSONObject[])" + "Exception was thrown in on(String, JSONObject[]).\n" + "Message was: " + message.toString(), e)); } } catch (JSONException e) { From d2e069b6830218db074cd9ec246d502628fbdafc Mon Sep 17 00:00:00 2001 From: "Enno Boland (Gottox)" Date: Tue, 28 Feb 2012 18:20:34 +0100 Subject: [PATCH 05/29] Add test for server side acknowledges --- tests/io/socket/AbstractTestSocketIO.java | 18 ++++++++++++++++-- tests/io/socket/socketio.js | 10 +++++++++- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/tests/io/socket/AbstractTestSocketIO.java b/tests/io/socket/AbstractTestSocketIO.java index ee8da53..b946ce5 100644 --- a/tests/io/socket/AbstractTestSocketIO.java +++ b/tests/io/socket/AbstractTestSocketIO.java @@ -31,6 +31,8 @@ @RunWith(io.socket.RandomBlockJUnit4ClassRunner.class) public abstract class AbstractTestSocketIO implements IOCallback { + private static final String REQUEST_ACKNOWLEDGE = "requestAcknowledge"; + /** The Constant to the node executable */ private final static String NODE = "node"; @@ -38,7 +40,7 @@ public abstract class AbstractTestSocketIO implements IOCallback { private int port = -1; /** Timeout for the tests */ - private static final int TIMEOUT = 1000; + private static final int TIMEOUT = 100000; /** Received queues. */ LinkedBlockingQueue events; @@ -233,11 +235,14 @@ public void send() throws Exception { public void emitAndOn() throws Exception { doConnect(); + socket.emit("echo"); + assertEquals("Test String", "on", takeEvent()); + String str = "TESTSTRING"; socket.emit("echo", str); assertEquals("Test String", "on", takeEvent()); assertEquals(str, takeArg()); - + JSONObject obj = new JSONObject("{'foo':'bar'}"); socket.emit("echo", obj); assertEquals("Test JSON", "on", takeEvent()); @@ -345,6 +350,11 @@ public void ack(Object... args) { }, "TESTSTRING"); assertEquals("ack", takeEvent()); assertEquals("TESTSTRING", takeArg()); + + socket.emit(REQUEST_ACKNOWLEDGE, "TESTSTRING"); + assertEquals("on", takeEvent()); + assertEquals("TESTSTRING", takeArg()); + assertEquals("ACKNOWLEDGE:TESTSTRING", takeLine()); doClose(); } @@ -427,6 +437,7 @@ public void onConnect() { @Override public void onMessage(String data, IOAcknowledge ack) { events.add("onMessage_string"); + this.args.add(data); } @@ -451,6 +462,9 @@ public void onMessage(JSONObject json, IOAcknowledge ack) { @Override public void on(String event, IOAcknowledge ack, Object... args) { events.add("on"); + if(event.equals(REQUEST_ACKNOWLEDGE)) { + ack.ack(args); + } this.args.addAll(Arrays.asList(args)); } diff --git a/tests/io/socket/socketio.js b/tests/io/socket/socketio.js index c7e182e..b57ea4c 100644 --- a/tests/io/socket/socketio.js +++ b/tests/io/socket/socketio.js @@ -13,7 +13,10 @@ io.set('transports', [ process.argv[3] ]); var main = io.sockets.on('connection', function(socket) { socket.on('echo', function(data) { - socket.emit('echo', data); + if(data) + socket.emit('echo', data); + else + socket.emit('echo'); }); socket.on('echoSend', function(data) { if (typeof data == 'object') { @@ -25,6 +28,11 @@ var main = io.sockets.on('connection', function(socket) { socket.on('echoAck', function(data, ack) { ack(data); }); + socket.on('requestAcknowledge', function(data) { + socket.emit('requestAcknowledge', data, function(data) { + process.stdout.write("__:ACKNOWLEDGE:" + data + "\n"); + }); + }) socket.on('message', function(m) { process.stdout.write("__:MESSAGE:" + m + "\n"); }); From b171e75a508b2c45440403f1d6bf6e8a46d53d63 Mon Sep 17 00:00:00 2001 From: "Enno Boland (Gottox)" Date: Tue, 28 Feb 2012 18:59:19 +0100 Subject: [PATCH 06/29] typo fix --- tests/io/socket/AbstractTestSocketIO.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/io/socket/AbstractTestSocketIO.java b/tests/io/socket/AbstractTestSocketIO.java index b946ce5..660a68e 100644 --- a/tests/io/socket/AbstractTestSocketIO.java +++ b/tests/io/socket/AbstractTestSocketIO.java @@ -151,7 +151,7 @@ public void run() { } /** - * Tears down this test. Asures queues are empty. + * Tears down this test. Assures queues are empty. * * @throws Exception * the exception @@ -211,7 +211,7 @@ void doClose() throws Exception { // BEGIN TESTS /** - * Tests sending of a message to the server. Asures result by stdout. + * Tests sending of a message to the server. Assures result by stdout. * * @throws Exception * the exception From e14173b11d97af5826ee73b61e77a3303b289290 Mon Sep 17 00:00:00 2001 From: "Enno Boland (Gottox)" Date: Tue, 28 Feb 2012 19:06:37 +0100 Subject: [PATCH 07/29] typo fix --- src/io/socket/IOConnection.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/io/socket/IOConnection.java b/src/io/socket/IOConnection.java index 3727e94..7a9d7bd 100644 --- a/src/io/socket/IOConnection.java +++ b/src/io/socket/IOConnection.java @@ -649,7 +649,7 @@ public void transportMessage(String text) { findCallback(message).onError( new SocketIOException(message.getData())); if (message.getData().endsWith("+0")) { - // We are adviced to disconnect + // We are advised to disconnect cleanup(); } break; From a943baae9b2fc75228415b51d57737041b596dc7 Mon Sep 17 00:00:00 2001 From: "Enno Boland (Gottox)" Date: Tue, 28 Feb 2012 21:21:19 +0100 Subject: [PATCH 08/29] IOConnection: removing unneeded if. rearranging --- src/io/socket/IOConnection.java | 98 +++++++++++++++------------------ 1 file changed, 45 insertions(+), 53 deletions(-) diff --git a/src/io/socket/IOConnection.java b/src/io/socket/IOConnection.java index 7a9d7bd..300b75c 100644 --- a/src/io/socket/IOConnection.java +++ b/src/io/socket/IOConnection.java @@ -27,7 +27,6 @@ import org.json.JSONException; import org.json.JSONObject; -// TODO: Auto-generated Javadoc /** * The Class IOConnection. */ @@ -170,7 +169,6 @@ public void run() { * {@link IOTransport} */ private class ConnectThread extends Thread { - /** * Instantiates a new background thread. */ @@ -206,14 +204,12 @@ private void handshake() { InputStream stream = connection.getInputStream(); Scanner in = new Scanner(stream); response = in.nextLine(); - if (response.contains(":")) { - String[] data = response.split(":"); - heartbeatTimeout = Long.parseLong(data[1]) * 1000; - closingTimeout = Long.parseLong(data[2]) * 1000; - protocols = Arrays.asList(data[3].split(",")); - sessionId = data[0]; - } - } catch (IOException e) { + String[] data = response.split(":"); + sessionId = data[0]; + heartbeatTimeout = Long.parseLong(data[1]) * 1000; + closingTimeout = Long.parseLong(data[2]) * 1000; + protocols = Arrays.asList(data[3].split(",")); + } catch (Exception e) { error(new SocketIOException("Error while handshaking", e)); } } @@ -498,7 +494,7 @@ public void transportDisconnected() { * * @param error * the error {@link IOTransport} calls this, when an exception - * has occured and the transport is not usable anymore. + * has occurred and the transport is not usable anymore. */ public void transportError(Exception error) { this.lastException = error; @@ -717,48 +713,6 @@ public String getSessionId() { return sessionId; } - /** A dummy callback used when IOConnection receives a unexpected message. */ - final static public IOCallback DUMMY_CALLBACK = new IOCallback() { - private void out(String msg) { - logger.info("DUMMY CALLBACK: " + msg); - } - - @Override - public void onDisconnect() { - out("Disconnect"); - } - - @Override - public void onConnect() { - out("Connect"); - } - - @Override - public void onMessage(String data, IOAcknowledge ack) { - out("Message:\n" + data + "\n-------------"); - } - - @Override - public void onMessage(JSONObject json, IOAcknowledge ack) { - out("Message:\n" + json.toString() + "\n-------------"); - } - - @Override - public void on(String event, IOAcknowledge ack, Object... args) { - out("Event '" + event + "':\n"); - for (Object arg : args) - out(arg.toString()); - out("\n-------------"); - } - - @Override - public void onError(SocketIOException socketIOException) { - out("Error"); - throw new RuntimeException(socketIOException); - } - - }; - /** * sends a String message from {@link SocketIO} to the {@link IOTransport}. * @@ -857,4 +811,42 @@ private synchronized void setState(int state) { public IOTransport getTransport() { return transport; } + + /** A dummy callback used when IOConnection receives a unexpected message. */ + final static public IOCallback DUMMY_CALLBACK = new IOCallback() { + @Override + public void onDisconnect() { + logger.info("Disconnect"); + } + + @Override + public void onConnect() { + logger.info("Connect"); + } + + @Override + public void onMessage(String data, IOAcknowledge ack) { + logger.info("Message:\n" + data + "\n-------------"); + } + + @Override + public void onMessage(JSONObject json, IOAcknowledge ack) { + logger.info("Message:\n" + json.toString() + "\n-------------"); + } + + @Override + public void on(String event, IOAcknowledge ack, Object... args) { + logger.info("Event '" + event + "':\n"); + for (Object arg : args) + logger.info(arg.toString()); + logger.info("\n-------------"); + } + + @Override + public void onError(SocketIOException socketIOException) { + logger.info("Error"); + throw new RuntimeException(socketIOException); + } + + }; } From c4f7fb6cf31ee66f378b87041688aa14656b24c9 Mon Sep 17 00:00:00 2001 From: "Enno Boland (Gottox)" Date: Tue, 28 Feb 2012 21:22:14 +0100 Subject: [PATCH 09/29] TIMEOUT set to 1000ms --- tests/io/socket/AbstractTestSocketIO.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/io/socket/AbstractTestSocketIO.java b/tests/io/socket/AbstractTestSocketIO.java index 660a68e..82ee3cf 100644 --- a/tests/io/socket/AbstractTestSocketIO.java +++ b/tests/io/socket/AbstractTestSocketIO.java @@ -40,7 +40,7 @@ public abstract class AbstractTestSocketIO implements IOCallback { private int port = -1; /** Timeout for the tests */ - private static final int TIMEOUT = 100000; + private static final int TIMEOUT = 1000; /** Received queues. */ LinkedBlockingQueue events; From 2bd8da68abae29c55f73b57dae061a519d0d0d83 Mon Sep 17 00:00:00 2001 From: "Enno Boland (Gottox)" Date: Tue, 28 Feb 2012 21:24:48 +0100 Subject: [PATCH 10/29] replacing examples --- examples/AcknowledgeExample.java | 70 +++++++++++++++++++++++++++ examples/BasicExample.java | 80 +++++++++++++++++++++++++++++++ examples/Example.java | 82 -------------------------------- 3 files changed, 150 insertions(+), 82 deletions(-) create mode 100644 examples/AcknowledgeExample.java create mode 100644 examples/BasicExample.java delete mode 100644 examples/Example.java diff --git a/examples/AcknowledgeExample.java b/examples/AcknowledgeExample.java new file mode 100644 index 0000000..75e0d1c --- /dev/null +++ b/examples/AcknowledgeExample.java @@ -0,0 +1,70 @@ +/* + * socket.io-java-client Test.java + * + * Copyright (c) 2012, Enno Boland + * socket.io-java-client is a implementation of the socket.io protocol in Java. + * + * See LICENSE file for more information + */ +import io.socket.IOAcknowledge; +import io.socket.IOCallback; +import io.socket.SocketIO; +import io.socket.SocketIOException; + +import org.json.JSONObject; + +public class AcknowledgeExample implements IOCallback { + private SocketIO socket; + + /** + * @param args + */ + public static void main(String[] args) { + try { + new AcknowledgeExample(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public AcknowledgeExample() throws Exception { + socket = new SocketIO(); + socket.connect("http://127.0.0.1:3001/", this); + + // Sends a string to the server. + socket.send(new IOAcknowledge() { + @Override + public void ack(Object... args) { + System.out.println("Server acknowledges this package."); + for(Object o : args) + System.out.println(o.toString()); + } + }, "Hello Server"); + } + + @Override + public void onMessage(JSONObject json, IOAcknowledge ack) { + } + + @Override + public void onMessage(String data, IOAcknowledge ack) { + // acknowledges a package + ack.ack("argument1", 23.42, "argument3"); + } + + @Override + public void onError(SocketIOException socketIOException) { + } + + @Override + public void onDisconnect() { + } + + @Override + public void onConnect() { + } + + @Override + public void on(String event, IOAcknowledge ack, Object... args) { + } +} diff --git a/examples/BasicExample.java b/examples/BasicExample.java new file mode 100644 index 0000000..31c7006 --- /dev/null +++ b/examples/BasicExample.java @@ -0,0 +1,80 @@ +/* + * socket.io-java-client Test.java + * + * Copyright (c) 2012, Enno Boland + * socket.io-java-client is a implementation of the socket.io protocol in Java. + * + * See LICENSE file for more information + */ +import io.socket.IOAcknowledge; +import io.socket.IOCallback; +import io.socket.SocketIO; +import io.socket.SocketIOException; + +import org.json.JSONException; +import org.json.JSONObject; + +public class BasicExample implements IOCallback { + private SocketIO socket; + + /** + * @param args + */ + public static void main(String[] args) { + try { + new BasicExample(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public BasicExample() throws Exception { + socket = new SocketIO(); + socket.connect("http://127.0.0.1:3001/", this); + + // Sends a string to the server. + socket.send("Hello Server"); + + // Sends a JSON object to the server. + socket.send(new JSONObject().put("key", "value").put("key2", + "another value")); + + // Emits an event to the server. + socket.emit("event", "argument1", "argument2", 13.37); + } + + @Override + public void onMessage(JSONObject json, IOAcknowledge ack) { + try { + System.out.println("Server said:" + json.toString(2)); + } catch (JSONException e) { + e.printStackTrace(); + } + } + + @Override + public void onMessage(String data, IOAcknowledge ack) { + System.out.println("Server said: " + data); + } + + @Override + public void onError(SocketIOException socketIOException) { + System.out.println("an Error occured"); + socketIOException.printStackTrace(); + } + + @Override + public void onDisconnect() { + System.out.println("Connection terminated."); + } + + @Override + public void onConnect() { + System.out.println("Connection established"); + } + + @Override + public void on(String event, IOAcknowledge ack, Object... args) { + System.out.println("Server triggered event '" + event + "'"); + } +} diff --git a/examples/Example.java b/examples/Example.java deleted file mode 100644 index 347ff8f..0000000 --- a/examples/Example.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * socket.io-java-client Test.java - * - * Copyright (c) 2012, Enno Boland - * socket.io-java-client is a implementation of the socket.io protocol in Java. - * - * See LICENSE file for more information - */ -import io.socket.IOAcknowledge; -import io.socket.IOCallback; -import io.socket.SocketIO; -import io.socket.SocketIOException; - -import java.net.MalformedURLException; -import org.json.JSONException; -import org.json.JSONObject; - - -public class Example { - private static SocketIO socket; - static IOCallback callback = new IOCallback() { - - @Override - public void onMessage(JSONObject json, IOAcknowledge ack) { - - } - - @Override - public void onMessage(String data, IOAcknowledge ack) { - - } - - @Override - public void onError(SocketIOException socketIOException) { - System.out.println("Error"); - socketIOException.printStackTrace(); - } - - @Override - public void onDisconnect() { - - } - - @Override - public void onConnect() { - - } - - @Override - public void on(String event, IOAcknowledge ack, Object... args) { - try { - socket.emit("bla", new IOAcknowledge() { - - @Override - public void ack(Object... args) { - System.out.println("Fooo"); - }} ,new JSONObject().put("Hello", "World")); - ack.ack("Hello"); - } catch (JSONException e) { - e.printStackTrace(); - } - } - }; - - /** - * @param args - */ - public static void main(String[] args) { - try { - socket = new SocketIO(); - socket.connect("http://127.0.0.1:3001/", callback); - } catch (MalformedURLException e) { - e.printStackTrace(); - } - try { - Thread.sleep(10000); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - -} From 18c2f3e8773b5cc226751e305c1cc89e517fb735 Mon Sep 17 00:00:00 2001 From: "Enno Boland (Gottox)" Date: Tue, 28 Feb 2012 21:54:05 +0100 Subject: [PATCH 11/29] Adding a second basic example. --- README.markdown | 47 +++++++++++++--------------- examples/BasicExample2.java | 61 +++++++++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+), 25 deletions(-) create mode 100644 examples/BasicExample2.java diff --git a/README.markdown b/README.markdown index dae4e68..47fd9ac 100644 --- a/README.markdown +++ b/README.markdown @@ -49,49 +49,46 @@ Using socket.io-java-client is quite simple. But lets see: ``` java - // Initialise a socket: - SocketIO socket = new IOSocket("http://127.0.0.1:3001"); - socket.connect(new IOCallback() { + SocketIO socket = new SocketIO("http://127.0.0.1:3001/"); + socket.connect(new IOCallback() { @Override public void onMessage(JSONObject json, IOAcknowledge ack) { - System.out.println("We received a message: " + json.toString(2)); + try { + System.out.println("Server said:" + json.toString(2)); + } catch (JSONException e) { + e.printStackTrace(); + } } - + @Override - public void onMessage(String data, IOAcknowleged ack) { - System.out.println("We received a message:" + data); + public void onMessage(String data, IOAcknowledge ack) { + System.out.println("Server said: " + data); } - + @Override public void onError(SocketIOException socketIOException) { - System.out.println("Something went wrong. Lets exit"); - System.exit(0); + System.out.println("an Error occured"); + socketIOException.printStackTrace(); } - + @Override public void onDisconnect() { - System.out.println("Disconnected"); - System.exit(0); + System.out.println("Connection terminated."); } - + @Override public void onConnect() { - System.out.println("Connected"); + System.out.println("Connection established"); } - + @Override public void on(String event, IOAcknowledge ack, Object... args) { - try { - ack.ack("Roger that!"); - socket.emit("answer", new JSONObject().put("msg", "Hello again Socket.io!")); - } catch (JSONException e) { - e.printStackTrace(); - } + System.out.println("Server triggered event '" + event + "'"); } }); - - // This will be cached until the server is connected. - socket.emit("hello", new JSONObject().put("msg", "Hello Socket.io! :D")); + + socket.send("Hello Server!"); + ``` For further informations, read the [Javadoc](http://s01.de/~tox/hgexport/socket.io-java-client/). diff --git a/examples/BasicExample2.java b/examples/BasicExample2.java new file mode 100644 index 0000000..d022309 --- /dev/null +++ b/examples/BasicExample2.java @@ -0,0 +1,61 @@ +import java.net.MalformedURLException; + +import org.json.JSONException; +import org.json.JSONObject; + +import io.socket.IOAcknowledge; +import io.socket.IOCallback; +import io.socket.SocketIO; +import io.socket.SocketIOException; + +public class BasicExample2 { + public static void main(String[] args) { + try { + new BasicExample2(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public BasicExample2() throws Exception { + SocketIO socket = new SocketIO("http://127.0.0.1:3001/"); + socket.connect(new IOCallback() { + @Override + public void onMessage(JSONObject json, IOAcknowledge ack) { + try { + System.out.println("Server said:" + json.toString(2)); + } catch (JSONException e) { + e.printStackTrace(); + } + } + + @Override + public void onMessage(String data, IOAcknowledge ack) { + System.out.println("Server said: " + data); + } + + @Override + public void onError(SocketIOException socketIOException) { + System.out.println("an Error occured"); + socketIOException.printStackTrace(); + } + + @Override + public void onDisconnect() { + System.out.println("Connection terminated."); + } + + @Override + public void onConnect() { + System.out.println("Connection established"); + } + + @Override + public void on(String event, IOAcknowledge ack, Object... args) { + System.out.println("Server triggered event '" + event + "'"); + } + }); + + socket.send("Hello Server!"); + } +} From 1da0009c7e5ed2b6f86454c223bdc9f567a8f75d Mon Sep 17 00:00:00 2001 From: "Enno Boland (Gottox)" Date: Tue, 28 Feb 2012 22:00:54 +0100 Subject: [PATCH 12/29] changing build.xml --- build.xml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/build.xml b/build.xml index 9496a4b..38f2d94 100644 --- a/build.xml +++ b/build.xml @@ -83,8 +83,13 @@ - - + + + + + + + From ab16b3ffab513a08cea9d7465f739ebcded58b42 Mon Sep 17 00:00:00 2001 From: "Enno Boland (Gottox)" Date: Tue, 28 Feb 2012 22:12:07 +0100 Subject: [PATCH 13/29] changing build.xml --- build.xml | 75 ++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 47 insertions(+), 28 deletions(-) diff --git a/build.xml b/build.xml index 38f2d94..9c5a887 100644 --- a/build.xml +++ b/build.xml @@ -6,29 +6,35 @@ as the first entry and export the buildfile again. --> - - - + + + + + + - - + + + + + @@ -49,27 +55,12 @@ + + + + - - - - - - - - - - - - - - - - - - - - + @@ -83,15 +74,43 @@ + + + + + + + + + - - + + + + + - + + + + + + + + + + + + + + + + + From 2049d26ba858e6b106aed5265737de43f4f9dc3b Mon Sep 17 00:00:00 2001 From: "Enno Boland (Gottox)" Date: Wed, 29 Feb 2012 09:20:51 +0100 Subject: [PATCH 14/29] Move test utilities into its own package. --- tests/io/socket/AbstractTestSocketIO.java | 6 +++--- .../{ => testutils}/RandomBlockJUnit4ClassRunner.java | 2 +- tests/io/socket/{ => testutils}/socketio.js | 0 3 files changed, 4 insertions(+), 4 deletions(-) rename tests/io/socket/{ => testutils}/RandomBlockJUnit4ClassRunner.java (95%) rename tests/io/socket/{ => testutils}/socketio.js (100%) diff --git a/tests/io/socket/AbstractTestSocketIO.java b/tests/io/socket/AbstractTestSocketIO.java index 82ee3cf..097f6b8 100644 --- a/tests/io/socket/AbstractTestSocketIO.java +++ b/tests/io/socket/AbstractTestSocketIO.java @@ -28,7 +28,7 @@ /** * The Class AbstractTestSocketIO. */ -@RunWith(io.socket.RandomBlockJUnit4ClassRunner.class) +@RunWith(io.socket.testutils.RandomBlockJUnit4ClassRunner.class) public abstract class AbstractTestSocketIO implements IOCallback { private static final String REQUEST_ACKNOWLEDGE = "requestAcknowledge"; @@ -92,7 +92,7 @@ public void setUp() throws Exception { args = new LinkedBlockingQueue(); System.out.println("Connect with " + transport); node = Runtime.getRuntime().exec( - new String[] { NODE, "./tests/io/socket/socketio.js", + new String[] { NODE, "./tests/io/socket/testutils/socketio.js", "" + getPort(), transport }); stdoutThread = new Thread("stdoutThread") { @@ -291,7 +291,7 @@ public void namespaces() throws Exception { // which isn't connected yet, this sleep assures that these events // aren't submitted. This is a server side problem. Maybe socket.io-java // could cache these events until the server drops the connect event. - Thread.sleep(100); + Thread.sleep(200); doConnect(); ns1.disconnect(); diff --git a/tests/io/socket/RandomBlockJUnit4ClassRunner.java b/tests/io/socket/testutils/RandomBlockJUnit4ClassRunner.java similarity index 95% rename from tests/io/socket/RandomBlockJUnit4ClassRunner.java rename to tests/io/socket/testutils/RandomBlockJUnit4ClassRunner.java index 8a69a18..042aed7 100644 --- a/tests/io/socket/RandomBlockJUnit4ClassRunner.java +++ b/tests/io/socket/testutils/RandomBlockJUnit4ClassRunner.java @@ -1,4 +1,4 @@ -package io.socket; +package io.socket.testutils; import java.util.Collections; diff --git a/tests/io/socket/socketio.js b/tests/io/socket/testutils/socketio.js similarity index 100% rename from tests/io/socket/socketio.js rename to tests/io/socket/testutils/socketio.js From ce8ef82666ce6ec7724219c3e8b6ee32cd4a6e7b Mon Sep 17 00:00:00 2001 From: "Enno Boland (Gottox)" Date: Wed, 29 Feb 2012 09:21:34 +0100 Subject: [PATCH 15/29] Adding MutateProxy to test non-valid behavior of socket.io --- tests/io/socket/testutils/MutateProxy.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 tests/io/socket/testutils/MutateProxy.java diff --git a/tests/io/socket/testutils/MutateProxy.java b/tests/io/socket/testutils/MutateProxy.java new file mode 100644 index 0000000..76ee3bc --- /dev/null +++ b/tests/io/socket/testutils/MutateProxy.java @@ -0,0 +1,12 @@ +package io.socket.testutils; + +public class MutateProxy extends Thread { + public MutateProxy() { + super("MutateProxy"); + } + + @Override + public void run() { + super.run(); + } +} From 06516bf558873b1dfcbd491a6be1fc94c4cdccbf Mon Sep 17 00:00:00 2001 From: "Enno Boland (Gottox)" Date: Wed, 29 Feb 2012 10:44:23 +0100 Subject: [PATCH 16/29] Working on MutateProxy --- tests/io/socket/testutils/MutateProxy.java | 75 +++++++++++++++++++++- 1 file changed, 73 insertions(+), 2 deletions(-) diff --git a/tests/io/socket/testutils/MutateProxy.java b/tests/io/socket/testutils/MutateProxy.java index 76ee3bc..7fd4497 100644 --- a/tests/io/socket/testutils/MutateProxy.java +++ b/tests/io/socket/testutils/MutateProxy.java @@ -1,12 +1,83 @@ package io.socket.testutils; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.net.ServerSocket; +import java.net.Socket; +import java.net.UnknownHostException; +import java.nio.CharBuffer; + public class MutateProxy extends Thread { - public MutateProxy() { + int listenPort; + int socketPort; + private Forwarder serverToClient; + private Forwarder clientToServer; + + public MutateProxy(int listenPort, int socketPort) { super("MutateProxy"); + this.listenPort = listenPort; + this.socketPort = socketPort; } @Override public void run() { - super.run(); + try { + server(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + void server() throws IOException { + ServerSocket server = new ServerSocket(listenPort); + Socket connection; + while ((connection = server.accept()) != null) { + InputStreamReader reader = new InputStreamReader( + connection.getInputStream()); + OutputStreamWriter writer = new OutputStreamWriter( + connection.getOutputStream()); + client(reader, writer); + } + } + + private void client(final InputStreamReader clientReader, + final OutputStreamWriter clientWriter) throws UnknownHostException, + IOException { + Socket socket = new Socket("127.0.0.1", socketPort); + final InputStreamReader serverReader = new InputStreamReader( + socket.getInputStream()); + final OutputStreamWriter serverWriter = new OutputStreamWriter( + socket.getOutputStream()); + serverToClient = new Forwarder("serverToClient", serverReader, + clientWriter); + clientToServer = new Forwarder("clientToServer", clientReader, + serverWriter); + serverToClient.start(); + clientToServer.start(); + } + + private static class Forwarder extends Thread { + private OutputStreamWriter output; + private InputStreamReader input; + + public Forwarder(String name, InputStreamReader input, + OutputStreamWriter output) { + super(name); + this.output = output; + this.input = input; + } + + @Override + public void run() { + CharBuffer buffer = CharBuffer.allocate(1024); + try { + while(input.read(buffer) != 0) { + output.append(buffer.toString()); + } + } catch (IOException e) { + e.printStackTrace(); + } + } } } From 300863f354c7231a990ca6bdc4266dc4eb8546d9 Mon Sep 17 00:00:00 2001 From: "Enno Boland (Gottox)" Date: Wed, 29 Feb 2012 10:46:15 +0100 Subject: [PATCH 17/29] remove compile time warning --- examples/BasicExample2.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/examples/BasicExample2.java b/examples/BasicExample2.java index d022309..97fd19d 100644 --- a/examples/BasicExample2.java +++ b/examples/BasicExample2.java @@ -1,5 +1,3 @@ -import java.net.MalformedURLException; - import org.json.JSONException; import org.json.JSONObject; From 2de3e8f1bff2de27eb9b5d7e2eb71b5a727aa94b Mon Sep 17 00:00:00 2001 From: "Enno Boland (Gottox)" Date: Wed, 29 Feb 2012 10:55:43 +0100 Subject: [PATCH 18/29] add missing @Overrides --- src/io/socket/IOConnection.java | 1 + src/io/socket/IOMessage.java | 1 + tests/io/socket/AbstractTestSocketIO.java | 2 ++ tests/io/socket/testutils/RandomBlockJUnit4ClassRunner.java | 3 ++- 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/io/socket/IOConnection.java b/src/io/socket/IOConnection.java index 300b75c..216be32 100644 --- a/src/io/socket/IOConnection.java +++ b/src/io/socket/IOConnection.java @@ -180,6 +180,7 @@ public ConnectThread() { * Tries handshaking if necessary and connects with corresponding * transport afterwards. */ + @Override public void run() { if (IOConnection.this.getState() == STATE_INIT) handshake(); diff --git a/src/io/socket/IOMessage.java b/src/io/socket/IOMessage.java index ebfbe43..25120b5 100644 --- a/src/io/socket/IOMessage.java +++ b/src/io/socket/IOMessage.java @@ -117,6 +117,7 @@ public IOMessage(String message) { /** * Generates a String representation of this object. */ + @Override public String toString() { StringBuilder builder = new StringBuilder(); Iterator i = Arrays.asList(fields).iterator(); diff --git a/tests/io/socket/AbstractTestSocketIO.java b/tests/io/socket/AbstractTestSocketIO.java index 097f6b8..c2ae596 100644 --- a/tests/io/socket/AbstractTestSocketIO.java +++ b/tests/io/socket/AbstractTestSocketIO.java @@ -96,6 +96,7 @@ public void setUp() throws Exception { "" + getPort(), transport }); stdoutThread = new Thread("stdoutThread") { + @Override public void run() { BufferedReader reader = new BufferedReader( new InputStreamReader(node.getInputStream())); @@ -118,6 +119,7 @@ public void run() { } }; stderrThread = new Thread("stderrThread") { + @Override public void run() { BufferedReader reader = new BufferedReader( new InputStreamReader(node.getErrorStream())); diff --git a/tests/io/socket/testutils/RandomBlockJUnit4ClassRunner.java b/tests/io/socket/testutils/RandomBlockJUnit4ClassRunner.java index 042aed7..a70de3f 100644 --- a/tests/io/socket/testutils/RandomBlockJUnit4ClassRunner.java +++ b/tests/io/socket/testutils/RandomBlockJUnit4ClassRunner.java @@ -16,7 +16,8 @@ public RandomBlockJUnit4ClassRunner(Class klass) } - protected java.util.List computeTestMethods() { + @Override + protected java.util.List computeTestMethods() { java.util.List methods = super.computeTestMethods(); Collections.shuffle(methods); return methods; From 84c3be9a9dd164880cf9ff08d0cf083405dd94f0 Mon Sep 17 00:00:00 2001 From: "Enno Boland (Gottox)" Date: Wed, 29 Feb 2012 16:46:09 +0100 Subject: [PATCH 19/29] Small rearranging, fixing unintended name space deletion --- src/io/socket/IOConnection.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/io/socket/IOConnection.java b/src/io/socket/IOConnection.java index 216be32..95a8f3d 100644 --- a/src/io/socket/IOConnection.java +++ b/src/io/socket/IOConnection.java @@ -377,7 +377,13 @@ private void cleanup() { if (transport != null) transport.disconnect(); sockets.clear(); - connections.remove(urlStr); + synchronized (connections) { + List con = connections.get(urlStr); + if (con.size() > 1) + con.remove(this); + else + connections.remove(urlStr); + } logger.info("Cleanup"); backgroundTimer.cancel(); } @@ -425,7 +431,8 @@ private void sendPlain(String text) { * Invalidates an {@link IOTransport}, used for forced reconnecting. */ private void invalidateTransport() { - transport.invalidate(); + if (transport != null) + transport.invalidate(); transport = null; } @@ -487,6 +494,7 @@ public void transportConnected() { */ public void transportDisconnected() { this.lastException = null; + setState(STATE_INTERRUPTED); reconnect(); } @@ -665,9 +673,7 @@ public void transportMessage(String text) { public void reconnect() { synchronized (this) { if (getState() != STATE_INVALID) { - if (transport != null) - invalidateTransport(); - transport = null; + invalidateTransport(); setState(STATE_INTERRUPTED); if (reconnectTask != null) { reconnectTask.cancel(); From f1f3dc14a2e0fd2385a1ea4b9691e4d45cc06b0f Mon Sep 17 00:00:00 2001 From: "Enno Boland (Gottox)" Date: Wed, 29 Feb 2012 16:49:25 +0100 Subject: [PATCH 20/29] IOConnection: warning() should use logger, not System.out. --- src/io/socket/IOConnection.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/io/socket/IOConnection.java b/src/io/socket/IOConnection.java index 95a8f3d..4c82330 100644 --- a/src/io/socket/IOConnection.java +++ b/src/io/socket/IOConnection.java @@ -708,7 +708,7 @@ private IOCallback findCallback(IOMessage message) { * the message */ private void warning(String message) { - System.err.println(message); + logger.info(message); } /** From f9a13788f31ba3395806df37d70d5467a365afe8 Mon Sep 17 00:00:00 2001 From: "Enno Boland (Gottox)" Date: Wed, 29 Feb 2012 16:56:10 +0100 Subject: [PATCH 21/29] Integrating MutateProxy to tests, deactivated for now. --- tests/io/socket/AbstractTestSocketIO.java | 20 ++++-- tests/io/socket/testutils/MutateProxy.java | 75 ++++++++++++---------- 2 files changed, 57 insertions(+), 38 deletions(-) diff --git a/tests/io/socket/AbstractTestSocketIO.java b/tests/io/socket/AbstractTestSocketIO.java index c2ae596..1d4bbde 100644 --- a/tests/io/socket/AbstractTestSocketIO.java +++ b/tests/io/socket/AbstractTestSocketIO.java @@ -10,6 +10,8 @@ import static org.junit.Assert.*; +import io.socket.testutils.MutateProxy; + import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; @@ -63,6 +65,8 @@ public abstract class AbstractTestSocketIO implements IOCallback { /** The socket to test. */ private SocketIO socket; + private MutateProxy proxy = null; + /** The transport of this test */ static protected String transport = null; @@ -94,6 +98,8 @@ public void setUp() throws Exception { node = Runtime.getRuntime().exec( new String[] { NODE, "./tests/io/socket/testutils/socketio.js", "" + getPort(), transport }); + //proxy = new MutateProxy(getProxyPort(), getPort()); + //proxy.start(); stdoutThread = new Thread("stdoutThread") { @Override @@ -184,7 +190,7 @@ public void tearDown() throws Exception { */ void doConnect() throws Exception { // Setting up socket connection - socket = new SocketIO("http://127.0.0.1:" + getPort(), this); + socket = new SocketIO("http://127.0.0.1:" + getProxyPort(), this); assertEquals("onConnect", takeEvent()); assertEquals(transport, socket.getTransport()); } @@ -285,7 +291,7 @@ public void emitAndMessage() throws Exception { */ @Test(timeout = TIMEOUT) public void namespaces() throws Exception { - SocketIO ns1 = new SocketIO("http://127.0.0.1:" + getPort() + "/ns1", + SocketIO ns1 = new SocketIO("http://127.0.0.1:" + getProxyPort() + "/ns1", this); assertEquals("onConnect", takeEvent()); @@ -299,14 +305,14 @@ public void namespaces() throws Exception { ns1.disconnect(); assertEquals("onDisconnect", takeEvent()); - SocketIO ns2 = new SocketIO("http://127.0.0.1:" + getPort() + "/ns2", + SocketIO ns2 = new SocketIO("http://127.0.0.1:" + getProxyPort() + "/ns2", this); assertEquals("onConnect", takeEvent()); assertEquals("onMessage_string", takeEvent()); assertEquals("ns2", takeArg()); - SocketIO ns2_2 = new SocketIO("http://127.0.0.1:" + getPort() + "/ns2", + SocketIO ns2_2 = new SocketIO("http://127.0.0.1:" + getProxyPort() + "/ns2", this); assertEquals("onConnect", takeEvent()); @@ -488,8 +494,12 @@ public void onError(SocketIOException socketIOException) { */ public int getPort() { if (port == -1) - port = 2048 + (int) (Math.random() * 10000); + port = 2048 + (int) (Math.random() * 10000) * 2; return port; } + + public int getProxyPort() { + return getPort() + (proxy == null ? 0 : 1); + } } diff --git a/tests/io/socket/testutils/MutateProxy.java b/tests/io/socket/testutils/MutateProxy.java index 7fd4497..d25a162 100644 --- a/tests/io/socket/testutils/MutateProxy.java +++ b/tests/io/socket/testutils/MutateProxy.java @@ -1,23 +1,28 @@ package io.socket.testutils; import java.io.IOException; -import java.io.InputStreamReader; -import java.io.OutputStreamWriter; +import java.io.InputStream; +import java.io.OutputStream; import java.net.ServerSocket; import java.net.Socket; import java.net.UnknownHostException; -import java.nio.CharBuffer; public class MutateProxy extends Thread { int listenPort; int socketPort; private Forwarder serverToClient; private Forwarder clientToServer; + private ServerSocket server; public MutateProxy(int listenPort, int socketPort) { super("MutateProxy"); this.listenPort = listenPort; this.socketPort = socketPort; + try { + server = new ServerSocket(listenPort); + } catch (IOException e) { + e.printStackTrace(); + } } @Override @@ -30,53 +35,57 @@ public void run() { } void server() throws IOException { - ServerSocket server = new ServerSocket(listenPort); - Socket connection; - while ((connection = server.accept()) != null) { - InputStreamReader reader = new InputStreamReader( - connection.getInputStream()); - OutputStreamWriter writer = new OutputStreamWriter( - connection.getOutputStream()); - client(reader, writer); + Socket clientSocket; + while ((clientSocket = server.accept()) != null) { + client(clientSocket); } } - private void client(final InputStreamReader clientReader, - final OutputStreamWriter clientWriter) throws UnknownHostException, + private void client(Socket clientSocket) throws UnknownHostException, IOException { - Socket socket = new Socket("127.0.0.1", socketPort); - final InputStreamReader serverReader = new InputStreamReader( - socket.getInputStream()); - final OutputStreamWriter serverWriter = new OutputStreamWriter( - socket.getOutputStream()); - serverToClient = new Forwarder("serverToClient", serverReader, - clientWriter); - clientToServer = new Forwarder("clientToServer", clientReader, - serverWriter); + Socket serverSocket = new Socket("127.0.0.1", this.socketPort); + serverToClient = new Forwarder("serverToClient", serverSocket, + clientSocket); + clientToServer = new Forwarder("clientToServer", clientSocket, + serverSocket); serverToClient.start(); clientToServer.start(); } - private static class Forwarder extends Thread { - private OutputStreamWriter output; - private InputStreamReader input; + private class Forwarder extends Thread { + private Socket from; + private Socket to; - public Forwarder(String name, InputStreamReader input, - OutputStreamWriter output) { + public Forwarder(String name, Socket from, Socket to) { super(name); - this.output = output; - this.input = input; + this.from = from; + this.to = to; } @Override public void run() { - CharBuffer buffer = CharBuffer.allocate(1024); try { - while(input.read(buffer) != 0) { - output.append(buffer.toString()); + byte[] buffer = new byte[1024]; + InputStream fromStream = from.getInputStream(); + OutputStream toStream = to.getOutputStream(); + while (fromStream.read(buffer) > 0) { + toStream.write(buffer); + toStream.flush(); } } catch (IOException e) { - e.printStackTrace(); + synchronized (MutateProxy.this) { + System.err.println("Thread " + this.getName()); + e.printStackTrace(); + } + } finally { + try { + to.close(); + } catch (IOException e) { + } + try { + from.close(); + } catch (IOException e) { + } } } } From eddb9f1e8c64b76713cfd1202473f12545d11300 Mon Sep 17 00:00:00 2001 From: "Enno Boland (Gottox)" Date: Fri, 2 Mar 2012 00:37:51 +0100 Subject: [PATCH 22/29] Testsuite now uses MutateProxy. Has no effect yet. --- tests/io/socket/AbstractTestSocketIO.java | 4 ++-- tests/io/socket/testutils/MutateProxy.java | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/io/socket/AbstractTestSocketIO.java b/tests/io/socket/AbstractTestSocketIO.java index 1d4bbde..4636313 100644 --- a/tests/io/socket/AbstractTestSocketIO.java +++ b/tests/io/socket/AbstractTestSocketIO.java @@ -98,8 +98,8 @@ public void setUp() throws Exception { node = Runtime.getRuntime().exec( new String[] { NODE, "./tests/io/socket/testutils/socketio.js", "" + getPort(), transport }); - //proxy = new MutateProxy(getProxyPort(), getPort()); - //proxy.start(); + proxy = new MutateProxy(getPort()+1, getPort()); + proxy.start(); stdoutThread = new Thread("stdoutThread") { @Override diff --git a/tests/io/socket/testutils/MutateProxy.java b/tests/io/socket/testutils/MutateProxy.java index d25a162..8637daa 100644 --- a/tests/io/socket/testutils/MutateProxy.java +++ b/tests/io/socket/testutils/MutateProxy.java @@ -66,10 +66,11 @@ public Forwarder(String name, Socket from, Socket to) { public void run() { try { byte[] buffer = new byte[1024]; + int length; InputStream fromStream = from.getInputStream(); OutputStream toStream = to.getOutputStream(); - while (fromStream.read(buffer) > 0) { - toStream.write(buffer); + while ((length = fromStream.read(buffer)) >= 0) { + toStream.write(buffer, 0, length); toStream.flush(); } } catch (IOException e) { From 98f2cab811556c14ccb601eaf6ab7b0d27aa25ee Mon Sep 17 00:00:00 2001 From: "Enno Boland (Gottox)" Date: Fri, 2 Mar 2012 11:17:17 +0100 Subject: [PATCH 23/29] using Logger::warning() --- src/io/socket/IOConnection.java | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/src/io/socket/IOConnection.java b/src/io/socket/IOConnection.java index 4c82330..533b231 100644 --- a/src/io/socket/IOConnection.java +++ b/src/io/socket/IOConnection.java @@ -590,7 +590,7 @@ public void transportMessage(String text) { + "Message was: " + message.toString(), e)); } } catch (JSONException e) { - warning("Malformated JSON received"); + logger.warning("Malformated JSON received"); } break; case IOMessage.TYPE_EVENT: @@ -615,7 +615,7 @@ public void transportMessage(String text) { + "Message was: " + message.toString(), e)); } } catch (JSONException e) { - warning("Malformated JSON received"); + logger.warning("Malformated JSON received"); } break; @@ -626,7 +626,7 @@ public void transportMessage(String text) { int id = Integer.parseInt(data[0]); IOAcknowledge ack = acknowledge.get(id); if (ack == null) - warning("Received unknown ack packet"); + logger.warning("Received unknown ack packet"); else { JSONArray array = new JSONArray(data[1]); Object[] args = new Object[array.length()]; @@ -636,9 +636,9 @@ public void transportMessage(String text) { ack.ack(args); } } catch (NumberFormatException e) { - warning("Received malformated Acknowledge! This is potentially filling up the acknowledges!"); + logger.warning("Received malformated Acknowledge! This is potentially filling up the acknowledges!"); } catch (JSONException e) { - warning("Received malformated Acknowledge data!"); + logger.warning("Received malformated Acknowledge data!"); } } else if (data.length == 1) { sendPlain("6:::" + data[0]); @@ -661,7 +661,7 @@ public void transportMessage(String text) { case IOMessage.TYPE_NOOP: break; default: - warning("Unkown type received" + message.getType()); + logger.warning("Unkown type received" + message.getType()); break; } } @@ -695,22 +695,12 @@ public void reconnect() { private IOCallback findCallback(IOMessage message) { SocketIO socket = sockets.get(message.getEndpoint()); if (socket == null) { - warning("Cannot find socket for '" + message.getEndpoint() + "'"); + logger.warning("Cannot find socket for '" + message.getEndpoint() + "'"); return DUMMY_CALLBACK; } return socket.getCallback(); } - /** - * Handles a non-fatal error. - * - * @param message - * the message - */ - private void warning(String message) { - logger.info(message); - } - /** * Returns the session id. This should be called from a {@link IOTransport} * From d5cea47360334c740d2d075d61fce097e1797936 Mon Sep 17 00:00:00 2001 From: "Enno Boland (Gottox)" Date: Sat, 3 Mar 2012 02:02:15 +0100 Subject: [PATCH 24/29] Updating README --- README.markdown | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/README.markdown b/README.markdown index 47fd9ac..b9fe0ff 100644 --- a/README.markdown +++ b/README.markdown @@ -2,14 +2,13 @@ # Socket.IO-Client for Java -socket.io-java-client is a simple implementation of [socket.io](http://socket.io) for Java. +socket.io-java-client is an easy to use implementation of [socket.io](http://socket.io) for Java. It uses [Weberknecht](http://code.google.com/p/weberknecht/) as transport backend, but it's easy to write your own transport. See description below. An XHR-Transport is included, too. But it's not functional in its current state. -The API is inspired by [java-socket.io.client](https://github.com/benkay/java-socket.io.client) but as the license -of this project was unclear and it had some nasty bugs, I decided to write socket.io-java-client from the scratch. +The API is inspired by [java-socket.io.client](https://github.com/benkay/java-socket.io.client). Features: @@ -43,6 +42,10 @@ to build a jar-file: You'll find the socket.io-jar in jar/socketio.jar +### Bugs + +Please report any bugs feature requests to [the Github issue tracker](https://github.com/Gottox/socket.io-java-client/issues) + ## How to use Using socket.io-java-client is quite simple. But lets see: From f2a7438562692a762045b1a7ba6b225122abee0e Mon Sep 17 00:00:00 2001 From: "Enno Boland (Gottox)" Date: Sun, 4 Mar 2012 13:15:06 +0100 Subject: [PATCH 25/29] small change to example --- README.markdown | 1 + examples/BasicExample2.java | 1 + 2 files changed, 2 insertions(+) diff --git a/README.markdown b/README.markdown index b9fe0ff..bdc0896 100644 --- a/README.markdown +++ b/README.markdown @@ -90,6 +90,7 @@ Using socket.io-java-client is quite simple. But lets see: } }); + // This line is cached until the connection is establisched. socket.send("Hello Server!"); ``` diff --git a/examples/BasicExample2.java b/examples/BasicExample2.java index 97fd19d..edab8ca 100644 --- a/examples/BasicExample2.java +++ b/examples/BasicExample2.java @@ -54,6 +54,7 @@ public void on(String event, IOAcknowledge ack, Object... args) { } }); + // This line is cached until the connection is establisched. socket.send("Hello Server!"); } } From ae47cc42698664cb594099158b6a83d3d2ceb442 Mon Sep 17 00:00:00 2001 From: tox Date: Mon, 5 Mar 2012 11:28:12 +0100 Subject: [PATCH 26/29] Windows seems to need a bigger timeout to pass the tests. --- tests/io/socket/AbstractTestSocketIO.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/io/socket/AbstractTestSocketIO.java b/tests/io/socket/AbstractTestSocketIO.java index 4636313..0aa12d5 100644 --- a/tests/io/socket/AbstractTestSocketIO.java +++ b/tests/io/socket/AbstractTestSocketIO.java @@ -42,7 +42,7 @@ public abstract class AbstractTestSocketIO implements IOCallback { private int port = -1; /** Timeout for the tests */ - private static final int TIMEOUT = 1000; + private static final int TIMEOUT = 3000; /** Received queues. */ LinkedBlockingQueue events; From 0612060ef0969c1eaf0b2bf3a4ba0fc7430b1ca2 Mon Sep 17 00:00:00 2001 From: "Enno Boland (Gottox)" Date: Wed, 7 Mar 2012 20:12:21 +0100 Subject: [PATCH 27/29] support daisy chaining on addHeader(). --- src/io/socket/SocketIO.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/io/socket/SocketIO.java b/src/io/socket/SocketIO.java index 8006a4a..0cb68ae 100644 --- a/src/io/socket/SocketIO.java +++ b/src/io/socket/SocketIO.java @@ -12,6 +12,7 @@ import java.net.URL; import java.util.Properties; +import org.json.JSONArray; import org.json.JSONObject; /** @@ -218,7 +219,7 @@ private boolean setAndConnect(URL url, IOCallback callback) { * @param event * the event name * @param args - * the arguments + * arguments. can be any argument {@link JSONArray#put(Object)} can take. */ public void emit(final String event, final Object... args) { this.connection.emit(this, event, null, args); @@ -234,7 +235,7 @@ public void emit(final String event, final Object... args) { * @param ack * an acknowledge implementation * @param args - * the arguments + * arguments. can be any argument {@link JSONArray#put(Object)} can take. */ public void emit(final String event, IOAcknowledge ack, final Object... args) { @@ -360,21 +361,22 @@ public Properties getHeaders() { * @param headers * the headers used while handshaking */ - SocketIO setHeaders(Properties headers) { + void setHeaders(Properties headers) { this.headers = headers; - return this; } /** * Adds an header to the {@link #headers} + * @return SocketIO.this for daisy chaining. */ - public void addHeader(String key, String value) { + public SocketIO addHeader(String key, String value) { if (this.connection != null) throw new RuntimeException( "You may only set headers before connecting.\n" + " Try to use new SocketIO().addHeader(key, value).connect(host, callback) " + "instead of SocketIO(host, callback).addHeader(key, value)"); this.headers.setProperty(key, value); + return this; } /** From 06481dd491c3c01fd80161935b4eef7e945ac85f Mon Sep 17 00:00:00 2001 From: "Enno Boland (Gottox)" Date: Wed, 7 Mar 2012 20:15:39 +0100 Subject: [PATCH 28/29] updating javadoc --- .classpath | 6 +- doc/allclasses-frame.html | 14 +- doc/allclasses-noframe.html | 14 +- doc/constant-values.html | 168 +-------------- doc/deprecated-list.html | 8 +- doc/help-doc.html | 8 +- doc/index-files/index-1.html | 18 +- doc/index-files/index-2.html | 34 +-- doc/index-files/index-3.html | 24 +-- doc/index-files/index-4.html | 18 +- doc/index-files/index-5.html | 50 ++--- doc/index-files/index-6.html | 45 ++-- doc/index-files/index-7.html | 41 ++-- doc/index-files/index-8.html | 45 ++-- doc/index-files/index-9.html | 64 ++++-- doc/index.html | 2 +- doc/io/socket/IOAcknowledge.html | 8 +- doc/io/socket/IOCallback.html | 20 +- doc/io/socket/SocketIO.html | 203 ++++++++++++++---- doc/io/socket/SocketIOException.html | 38 ++-- doc/io/socket/class-use/IOAcknowledge.html | 67 +----- doc/io/socket/class-use/IOCallback.html | 32 +-- doc/io/socket/class-use/SocketIO.html | 65 +----- .../socket/class-use/SocketIOException.html | 16 +- doc/io/socket/package-frame.html | 18 +- doc/io/socket/package-summary.html | 24 +-- doc/io/socket/package-tree.html | 19 +- doc/io/socket/package-use.html | 16 +- doc/overview-tree.html | 19 +- doc/serialized-form.html | 10 +- 30 files changed, 425 insertions(+), 689 deletions(-) diff --git a/.classpath b/.classpath index 582029f..71ba817 100644 --- a/.classpath +++ b/.classpath @@ -4,7 +4,11 @@ - + + + + + diff --git a/doc/allclasses-frame.html b/doc/allclasses-frame.html index f8ef012..337dc3d 100644 --- a/doc/allclasses-frame.html +++ b/doc/allclasses-frame.html @@ -2,12 +2,12 @@ - + All Classes - + @@ -25,20 +25,10 @@
IOCallback
-IOConnection -
-IOMessage -
-IOTransport -
SocketIO
SocketIOException
-WebsocketTransport -
-XhrTransport -
diff --git a/doc/allclasses-noframe.html b/doc/allclasses-noframe.html index 987e311..827d632 100644 --- a/doc/allclasses-noframe.html +++ b/doc/allclasses-noframe.html @@ -2,12 +2,12 @@ - + All Classes - + @@ -25,20 +25,10 @@
IOCallback
-IOConnection -
-IOMessage -
-IOTransport -
SocketIO
SocketIOException
-WebsocketTransport -
-XhrTransport -
diff --git a/doc/constant-values.html b/doc/constant-values.html index b267bb6..ac0b991 100644 --- a/doc/constant-values.html +++ b/doc/constant-values.html @@ -2,12 +2,12 @@ - + Constant Field Values - + @@ -40,7 +40,7 @@ Package  Class  Use  - Tree  + Tree  Deprecated  Index  Help  @@ -84,168 +84,8 @@


Contents - - - - - -
-io.socket.*
- -

- - - - - - - - - - - - -
io.socket.io.socket.IOConnection
-public static final java.lang.StringSOCKET_IO_1"/socket.io/1/"
- -

- -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
io.socket.io.socket.IOMessage
-public static final intFIELD_DATA3
-public static final intFIELD_ENDPOINT2
-public static final intFIELD_ID1
-public static final intFIELD_TYPE0
-public static final intNUM_FIELDS4
-public static final intTYPE_ACK6
-public static final intTYPE_CONNECT1
-public static final intTYPE_DISCONNECT0
-public static final intTYPE_ERROR7
-public static final intTYPE_EVENT5
-public static final intTYPE_HEARTBEAT2
-public static final intTYPE_JSON_MESSAGE4
-public static final intTYPE_MESSAGE3
-public static final intTYPE_NOOP8
- -

- -

- - - - - - - - - - - - -
io.socket.io.socket.WebsocketTransport
-public static final java.lang.StringTRANSPORT_NAME"websocket"
- -

- -

- - - - - - - - - - - - -
io.socket.io.socket.XhrTransport
-public static final java.lang.StringTRANSPORT_NAME"xhr-polling"
- -

- -


@@ -261,7 +101,7 @@

Package  Class  Use  - Tree  + Tree  Deprecated  Index  Help  diff --git a/doc/deprecated-list.html b/doc/deprecated-list.html index 366d908..fdf2a6c 100644 --- a/doc/deprecated-list.html +++ b/doc/deprecated-list.html @@ -2,12 +2,12 @@ - + Deprecated List - + @@ -40,7 +40,7 @@ Package  Class  Use  - Tree  + Tree   Deprecated  Index  Help  @@ -101,7 +101,7 @@

Package  Class  Use  - Tree  + Tree   Deprecated  Index  Help  diff --git a/doc/help-doc.html b/doc/help-doc.html index b44fbb8..964ffd0 100644 --- a/doc/help-doc.html +++ b/doc/help-doc.html @@ -2,12 +2,12 @@ - + API Help - + @@ -40,7 +40,7 @@ Package  Class  Use  - Tree  + Tree  Deprecated  Index   Help  @@ -172,7 +172,7 @@

Package  Class  Use  - Tree  + Tree  Deprecated  Index   Help  diff --git a/doc/index-files/index-1.html b/doc/index-files/index-1.html index 3e838f7..ed06d1d 100644 --- a/doc/index-files/index-1.html +++ b/doc/index-files/index-1.html @@ -2,12 +2,12 @@ - + A-Index - + @@ -40,7 +40,7 @@ Package  Class  Use  - Tree  + Tree  Deprecated   Index  Help  @@ -77,16 +77,16 @@ -A C D E F G H I N O P Q R S T U W X
+A C D E G I O R S

A

ack(Object...) - Method in interface io.socket.IOAcknowledge
Acknowledges a socket.io message. -
acknowledge - -Variable in class io.socket.IOConnection -
Acknowledges. +
addHeader(String, String) - +Method in class io.socket.SocketIO +
Adds an header to the SocketIO.headers

@@ -103,7 +103,7 @@ Package  Class  Use  - Tree  + Tree  Deprecated   Index  Help  @@ -140,7 +140,7 @@ -A C D E F G H I N O P Q R S T U W X
+A C D E G I O R S
diff --git a/doc/index-files/index-2.html b/doc/index-files/index-2.html index 8509ce6..945ff1f 100644 --- a/doc/index-files/index-2.html +++ b/doc/index-files/index-2.html @@ -2,12 +2,12 @@ - + C-Index - + @@ -40,7 +40,7 @@ Package  Class  Use  - Tree  + Tree  Deprecated   Index  Help  @@ -77,23 +77,10 @@ -A C D E F G H I N O P Q R S T U W X
+A C D E G I O R S

C

-
canSendBulk() - -Method in interface io.socket.IOTransport -
return true if the IOTransport prefers to send multiple messages at a - time. -
canSendBulk() - -Method in class io.socket.WebsocketTransport -
  -
canSendBulk() - -Method in class io.socket.XhrTransport -
  -
connect() - -Method in interface io.socket.IOTransport -
Instructs the IOTransport to connect.
connect(String, IOCallback) - Method in class io.socket.SocketIO
connects to supplied host using callback. @@ -103,15 +90,6 @@
connect(IOCallback) - Method in class io.socket.SocketIO
connects to an already set host. -
connect() - -Method in class io.socket.XhrTransport -
  -
create(URL, IOConnection) - -Static method in class io.socket.WebsocketTransport -
Creates a new Transport for the given url an IOConnection. -
create(URL, IOConnection) - -Static method in class io.socket.XhrTransport -
Creates a new Transport for the given url an IOConnection.

@@ -128,7 +106,7 @@ Package  Class  Use  - Tree  + Tree  Deprecated   Index  Help  @@ -165,7 +143,7 @@ -A C D E F G H I N O P Q R S T U W X
+A C D E G I O R S
diff --git a/doc/index-files/index-3.html b/doc/index-files/index-3.html index 87ebc0a..a475499 100644 --- a/doc/index-files/index-3.html +++ b/doc/index-files/index-3.html @@ -2,12 +2,12 @@ - + D-Index - + @@ -40,7 +40,7 @@ Package  Class  Use  - Tree  + Tree  Deprecated   Index  Help  @@ -77,25 +77,13 @@ -A C D E F G H I N O P Q R S T U W X
+A C D E G I O R S

D

-
disconnect() - -Method in interface io.socket.IOTransport -
Instructs the IOTransport to disconnect.
disconnect() - Method in class io.socket.SocketIO
Disconnect the socket. -
disconnect() - -Method in class io.socket.WebsocketTransport -
  -
disconnect() - -Method in class io.socket.XhrTransport -
  -
DUMMY_CALLBACK - -Static variable in class io.socket.IOConnection -
A dummy callback used when IOConnection receives a unexpected message.

@@ -112,7 +100,7 @@ Package  Class  Use  - Tree  + Tree  Deprecated   Index  Help  @@ -149,7 +137,7 @@ -A C D E F G H I N O P Q R S T U W X
+A C D E G I O R S
diff --git a/doc/index-files/index-4.html b/doc/index-files/index-4.html index da38ae6..33f4b18 100644 --- a/doc/index-files/index-4.html +++ b/doc/index-files/index-4.html @@ -2,12 +2,12 @@ - + E-Index - + @@ -40,7 +40,7 @@ Package  Class  Use  - Tree  + Tree  Deprecated   Index  Help  @@ -77,22 +77,16 @@ -A C D E F G H I N O P Q R S T U W X
+A C D E G I O R S

E

-
emit(SocketIO, String, IOAcknowledge, Object...) - -Method in class io.socket.IOConnection -
emits an event from SocketIO to the IOTransport.
emit(String, Object...) - Method in class io.socket.SocketIO
Emits an event to the Socket.IO server.
emit(String, IOAcknowledge, Object...) - Method in class io.socket.SocketIO
Emits an event to the Socket.IO server. -
error(SocketIOException) - -Method in class io.socket.IOConnection -
Populates an error to the connected IOCallbacks and shuts down.

@@ -109,7 +103,7 @@ Package  Class  Use  - Tree  + Tree  Deprecated   Index  Help  @@ -146,7 +140,7 @@ -A C D E F G H I N O P Q R S T U W X
+A C D E G I O R S
diff --git a/doc/index-files/index-5.html b/doc/index-files/index-5.html index ee0f656..ea69f56 100644 --- a/doc/index-files/index-5.html +++ b/doc/index-files/index-5.html @@ -2,12 +2,12 @@ - + -F-Index +G-Index - + @@ -15,7 +15,7 @@ function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { - parent.document.title="F-Index"; + parent.document.title="G-Index"; } } @@ -40,7 +40,7 @@ Package  Class  Use  - Tree  + Tree  Deprecated   Index  Help  @@ -77,25 +77,25 @@ -A C D E F G H I N O P Q R S T U W X
-

-F

+A C D E G I O R S
+

+G

-
FIELD_DATA - -Static variable in class io.socket.IOMessage -
Index of the data field in a message -
FIELD_ENDPOINT - -Static variable in class io.socket.IOMessage -
Index of the endpoint field in a message -
FIELD_ID - -Static variable in class io.socket.IOMessage -
Index of the id field in a message -
FIELD_TYPE - -Static variable in class io.socket.IOMessage -
Index of the type field in a message -
fields - -Variable in class io.socket.IOMessage -
The field values +
getCallback() - +Method in class io.socket.SocketIO +
Gets the callback. +
getHeader(String) - +Method in class io.socket.SocketIO +
Returns the header value +
getHeaders() - +Method in class io.socket.SocketIO +
Returns the headers used while handshaking. +
getNamespace() - +Method in class io.socket.SocketIO +
Gets the namespace. +
getTransport() - +Method in class io.socket.SocketIO +
Returns the name of the used transport

@@ -112,7 +112,7 @@ Package  Class  Use  - Tree  + Tree  Deprecated   Index  Help  @@ -149,7 +149,7 @@ -A C D E F G H I N O P Q R S T U W X
+A C D E G I O R S
diff --git a/doc/index-files/index-6.html b/doc/index-files/index-6.html index ea13f26..6e506c4 100644 --- a/doc/index-files/index-6.html +++ b/doc/index-files/index-6.html @@ -2,12 +2,12 @@ - + -G-Index +I-Index - + @@ -15,7 +15,7 @@ function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { - parent.document.title="G-Index"; + parent.document.title="I-Index"; } } @@ -40,7 +40,7 @@ Package  Class  Use  - Tree  + Tree  Deprecated   Index  Help  @@ -77,34 +77,13 @@ -A C D E F G H I N O P Q R S T U W X
-

-G

+A C D E G I O R S
+

+I

-
getCallback() - +
io.socket - package io.socket
 
IOAcknowledge - Interface in io.socket
The Interface IOAcknowledge.
IOCallback - Interface in io.socket
The Interface IOCallback.
isConnected() - Method in class io.socket.SocketIO -
Gets the callback. -
getData() - -Method in class io.socket.IOMessage -
Returns the data of this IOMessage. -
getEndpoint() - -Method in class io.socket.IOMessage -
Returns the endpoint of this IOMessage. -
getId() - -Method in class io.socket.IOMessage -
Returns the id of this IOMessage. -
getNamespace() - -Method in class io.socket.SocketIO -
Gets the namespace. -
getSessionId() - -Method in class io.socket.IOConnection -
Returns the session id. -
getState() - -Method in class io.socket.IOConnection -
  -
getType() - -Method in class io.socket.IOMessage -
Returns the type of this IOMessage. +
Returns, if a connection is established at the moment

@@ -121,7 +100,7 @@ Package  Class  Use  - Tree  + Tree  Deprecated   Index  Help  @@ -158,7 +137,7 @@ -A C D E F G H I N O P Q R S T U W X
+A C D E G I O R S
diff --git a/doc/index-files/index-7.html b/doc/index-files/index-7.html index aba11c8..6d54d4d 100644 --- a/doc/index-files/index-7.html +++ b/doc/index-files/index-7.html @@ -2,12 +2,12 @@ - + -H-Index +O-Index - + @@ -15,7 +15,7 @@ function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { - parent.document.title="H-Index"; + parent.document.title="O-Index"; } } @@ -40,7 +40,7 @@ Package  Class  Use  - Tree  + Tree  Deprecated   Index  Help  @@ -77,13 +77,28 @@ -A C D E F G H I N O P Q R S T U W X
-

-H

+A C D E G I O R S
+

+O

-
heartBeatTask - -Variable in class io.socket.IOConnection -
The heart beat task. +
on(String, IOAcknowledge, Object...) - +Method in interface io.socket.IOCallback +
On [Event]. +
onConnect() - +Method in interface io.socket.IOCallback +
On connect. +
onDisconnect() - +Method in interface io.socket.IOCallback +
On disconnect. +
onError(SocketIOException) - +Method in interface io.socket.IOCallback +
On error. +
onMessage(String, IOAcknowledge) - +Method in interface io.socket.IOCallback +
On message. +
onMessage(JSONObject, IOAcknowledge) - +Method in interface io.socket.IOCallback +
On message.

@@ -100,7 +115,7 @@ Package  Class  Use  - Tree  + Tree  Deprecated   Index  Help  @@ -137,7 +152,7 @@ -A C D E F G H I N O P Q R S T U W X
+A C D E G I O R S
diff --git a/doc/index-files/index-8.html b/doc/index-files/index-8.html index e5bbb44..0abae11 100644 --- a/doc/index-files/index-8.html +++ b/doc/index-files/index-8.html @@ -2,12 +2,12 @@ - + -I-Index +R-Index - + @@ -15,7 +15,7 @@ function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { - parent.document.title="I-Index"; + parent.document.title="R-Index"; } } @@ -40,7 +40,7 @@ Package  Class  Use  - Tree  + Tree  Deprecated   Index  Help  @@ -77,34 +77,13 @@ -A C D E F G H I N O P Q R S T U W X
-

-I

+A C D E G I O R S
+

+R

-
invalidate() - -Method in interface io.socket.IOTransport -
Instructs the IOTransport to invalidate. -
invalidate() - -Method in class io.socket.WebsocketTransport -
  -
invalidate() - -Method in class io.socket.XhrTransport -
  -
io.socket - package io.socket
 
IOAcknowledge - Interface in io.socket
The Interface IOAcknowledge.
IOCallback - Interface in io.socket
The Interface IOCallback.
IOConnection - Class in io.socket
The Class IOConnection.
IOMessage - Class in io.socket
The Class IOMessage.
IOMessage(int, String, String, String) - -Constructor for class io.socket.IOMessage -
Instantiates a new IOMessage by given data. -
IOMessage(int, String, String) - -Constructor for class io.socket.IOMessage -
Instantiates a new IOMessage by given data. -
IOMessage(String) - -Constructor for class io.socket.IOMessage -
Instantiates a new IOMessage from a String representation. -
IOTransport - Interface in io.socket
The Interface IOTransport.
isConnected() - -Method in class io.socket.IOConnection -
Checks if IOConnection is currently connected. -
isConnected() - +
reconnect() - Method in class io.socket.SocketIO -
Returns, if a connection is established at the moment +
Triggers the transport to reconnect.

@@ -121,7 +100,7 @@ Package  Class  Use  - Tree  + Tree  Deprecated   Index  Help  @@ -158,7 +137,7 @@ -A C D E F G H I N O P Q R S T U W X
+A C D E G I O R S
diff --git a/doc/index-files/index-9.html b/doc/index-files/index-9.html index 5c693bc..feb5b71 100644 --- a/doc/index-files/index-9.html +++ b/doc/index-files/index-9.html @@ -2,12 +2,12 @@ - + -N-Index +S-Index - + @@ -15,7 +15,7 @@ function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { - parent.document.title="N-Index"; + parent.document.title="S-Index"; } } @@ -40,7 +40,7 @@ Package  Class  Use  - Tree  + Tree  Deprecated   Index  Help  @@ -55,7 +55,7 @@  PREV LETTER  - NEXT LETTER + NEXT LETTER FRAMES    NO FRAMES   @@ -77,13 +77,47 @@ -A C D E F G H I N O P Q R S T U W X
-

-N

+A C D E G I O R S
+

+S

-
NUM_FIELDS - -Static variable in class io.socket.IOMessage -
Number of fields in a message. +
send(JSONObject) - +Method in class io.socket.SocketIO +
Send JSON data to the Socket.io server. +
send(IOAcknowledge, JSONObject) - +Method in class io.socket.SocketIO +
Send JSON data to the Socket.io server. +
send(String) - +Method in class io.socket.SocketIO +
Send String data to the Socket.io server. +
send(IOAcknowledge, String) - +Method in class io.socket.SocketIO +
Send JSON data to the Socket.io server. +
SocketIO - Class in io.socket
The Class SocketIO.
SocketIO() - +Constructor for class io.socket.SocketIO +
Instantiates a new socket.io connection. +
SocketIO(String) - +Constructor for class io.socket.SocketIO +
Instantiates a new socket.io connection. +
SocketIO(String, Properties) - +Constructor for class io.socket.SocketIO +
Instantiates a new socket.io connection and sets the request headers used + while connecting the first time for authorizing. +
SocketIO(String, IOCallback) - +Constructor for class io.socket.SocketIO +
Instantiates a new socket.io object and connects to the given url. +
SocketIO(URL, IOCallback) - +Constructor for class io.socket.SocketIO +
Instantiates a new socket.io object and connects to the given url. +
SocketIO(URL) - +Constructor for class io.socket.SocketIO +
Instantiates a new socket.io connection. +
SocketIOException - Exception in io.socket
The Class SocketIOException.
SocketIOException(String) - +Constructor for exception io.socket.SocketIOException +
Instantiates a new SocketIOException. +
SocketIOException(String, Exception) - +Constructor for exception io.socket.SocketIOException +
Instantiates a new SocketIOException.

@@ -100,7 +134,7 @@ Package  Class  Use  - Tree  + Tree  Deprecated   Index  Help  @@ -115,7 +149,7 @@  PREV LETTER  - NEXT LETTER + NEXT LETTER
FRAMES    NO FRAMES   @@ -137,7 +171,7 @@ -A C D E F G H I N O P Q R S T U W X
+A C D E G I O R S
diff --git a/doc/index.html b/doc/index.html index 769ac1d..ea6c517 100644 --- a/doc/index.html +++ b/doc/index.html @@ -2,7 +2,7 @@ - + Generated Documentation (Untitled) diff --git a/doc/io/socket/IOAcknowledge.html b/doc/io/socket/IOAcknowledge.html index 1de0029..48b316e 100644 --- a/doc/io/socket/IOAcknowledge.html +++ b/doc/io/socket/IOAcknowledge.html @@ -2,12 +2,12 @@ - + IOAcknowledge - + @@ -115,7 +115,7 @@

 void -ack(java.lang.Object... args) +ack(Object... args)
          Acknowledges a socket.io message. @@ -137,7 +137,7 @@

ack

-void ack(java.lang.Object... args)
+void ack(Object... args)
Acknowledges a socket.io message.

diff --git a/doc/io/socket/IOCallback.html b/doc/io/socket/IOCallback.html index 3ae3747..3dfb49e 100644 --- a/doc/io/socket/IOCallback.html +++ b/doc/io/socket/IOCallback.html @@ -2,12 +2,12 @@ - + IOCallback - + @@ -55,7 +55,7 @@  PREV CLASS  - NEXT CLASSNEXT CLASS FRAMES    NO FRAMES   @@ -115,9 +115,9 @@

 void -on(java.lang.String event, +on(String event, IOAcknowledge ack, - java.lang.Object... args) + Object... args)
          On [Event]. @@ -158,7 +158,7 @@

 void -onMessage(java.lang.String data, +onMessage(String data, IOAcknowledge ack)
@@ -207,7 +207,7 @@

onMessage

-void onMessage(java.lang.String data,
+void onMessage(String data,
                IOAcknowledge ack)
On message. Called when the server sends String data. @@ -235,9 +235,9 @@

on

-void on(java.lang.String event,
+void on(String event,
         IOAcknowledge ack,
-        java.lang.Object... args)
+ Object... args)
On [Event]. Called when server emits an event.

@@ -289,7 +289,7 @@

 PREV CLASS  - NEXT CLASSNEXT CLASS FRAMES    NO FRAMES   diff --git a/doc/io/socket/SocketIO.html b/doc/io/socket/SocketIO.html index bfcde40..8c76e65 100644 --- a/doc/io/socket/SocketIO.html +++ b/doc/io/socket/SocketIO.html @@ -2,12 +2,12 @@ - + SocketIO - + @@ -54,7 +54,7 @@ PREV CLASS  + PREV CLASS   NEXT CLASS FRAMES   @@ -91,12 +91,12 @@


Class SocketIO

-java.lang.Object
+java.lang.Object
   extended by io.socket.SocketIO
 

-
public class SocketIO
extends java.lang.Object
+
public class SocketIO
extends Object

@@ -123,26 +123,34 @@

          Instantiates a new socket.io connection. -SocketIO(java.lang.String url) +SocketIO(String url)
          Instantiates a new socket.io connection. -SocketIO(java.lang.String url, +SocketIO(String url, IOCallback callback)
          Instantiates a new socket.io object and connects to the given url. -SocketIO(java.net.URL url) +SocketIO(String url, + Properties headers) + +
+          Instantiates a new socket.io connection and sets the request headers used + while connecting the first time for authorizing. + + +SocketIO(URL url)
          Instantiates a new socket.io connection. -SocketIO(java.net.URL url, +SocketIO(URL url, IOCallback callback)
@@ -160,6 +168,15 @@

+ SocketIO +addHeader(String key, + String value) + +
+          Adds an header to the headers + + +  void connect(IOCallback callback) @@ -169,7 +186,7 @@

 void -connect(java.lang.String url, +connect(String url, IOCallback callback)
@@ -178,7 +195,7 @@

 void -connect(java.net.URL url, +connect(URL url, IOCallback callback)
@@ -195,9 +212,9 @@

 void -emit(java.lang.String event, +emit(String event, IOAcknowledge ack, - java.lang.Object... args) + Object... args)
          Emits an event to the Socket.IO server. @@ -205,8 +222,8 @@

 void -emit(java.lang.String event, - java.lang.Object... args) +emit(String event, + Object... args)
          Emits an event to the Socket.IO server. @@ -221,7 +238,23 @@

- java.lang.String + String +getHeader(String key) + +
+          Returns the header value + + + + Properties +getHeaders() + +
+          Returns the headers used while handshaking. + + + + String getNamespace()
@@ -229,6 +262,14 @@

+ String +getTransport() + +
+          Returns the name of the used transport + + +  boolean isConnected() @@ -256,7 +297,7 @@

 void send(IOAcknowledge ack, - java.lang.String message) + String message)
          Send JSON data to the Socket.io server. @@ -272,7 +313,7 @@

 void -send(java.lang.String message) +send(String message)
          Send String data to the Socket.io server. @@ -281,10 +322,10 @@

  - + - +
Methods inherited from class java.lang.ObjectMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  @@ -315,8 +356,8 @@

SocketIO

-public SocketIO(java.lang.String url)
-         throws java.net.MalformedURLException
+public SocketIO(String url) + throws MalformedURLException
Instantiates a new socket.io connection. The object connects after calling connect(IOCallback) @@ -324,16 +365,34 @@

Parameters:
url - the url
Throws: -
java.net.MalformedURLException - the malformed url exception
+
MalformedURLException - the malformed url exception

+

+
+ +

+SocketIO

+
+public SocketIO(String url,
+                Properties headers)
+         throws MalformedURLException
+
+
Instantiates a new socket.io connection and sets the request headers used + while connecting the first time for authorizing. The object connects + after calling connect(IOCallback) +

+

+
Parameters:
url - the url
headers - the headers used while handshaking +
Throws: +
MalformedURLException - the malformed url exception

SocketIO

-public SocketIO(java.lang.String url,
+public SocketIO(String url,
                 IOCallback callback)
-         throws java.net.MalformedURLException
+ throws MalformedURLException
Instantiates a new socket.io object and connects to the given url. Do not call any of the connect() methods afterwards. @@ -341,14 +400,14 @@

Parameters:
url - the url
callback - the callback
Throws: -
java.net.MalformedURLException - the malformed url exception
+
MalformedURLException - the malformed url exception


SocketIO

-public SocketIO(java.net.URL url,
+public SocketIO(URL url,
                 IOCallback callback)
Instantiates a new socket.io object and connects to the given url. Do not @@ -362,7 +421,7 @@

SocketIO

-public SocketIO(java.net.URL url)
+public SocketIO(URL url)
Instantiates a new socket.io connection. The object connects after calling connect(IOCallback) @@ -384,9 +443,9 @@

connect

-public void connect(java.lang.String url,
+public void connect(String url,
                     IOCallback callback)
-             throws java.net.MalformedURLException
+ throws MalformedURLException
connects to supplied host using callback. Do only use this method if you instantiate SocketIO using SocketIO(). @@ -394,7 +453,7 @@

Parameters:
url - the url
callback - the callback
Throws: -
java.net.MalformedURLException
+
MalformedURLException


@@ -402,7 +461,7 @@

connect

-public void connect(java.net.URL url,
+public void connect(URL url,
                     IOCallback callback)
connects to supplied host using callback. Do only use this method if you @@ -432,15 +491,15 @@

emit

-public void emit(java.lang.String event,
-                 java.lang.Object... args)
+public void emit(String event, + Object... args)
Emits an event to the Socket.IO server. If the connection is not established, the call will be buffered and sent as soon as it is possible.

-
Parameters:
event - the event name
args - the arguments
+
Parameters:
event - the event name
args - arguments. can be any argument JSONArray.put(Object) can take.

@@ -448,16 +507,16 @@

emit

-public void emit(java.lang.String event,
+public void emit(String event,
                  IOAcknowledge ack,
-                 java.lang.Object... args)
+ Object... args)
Emits an event to the Socket.IO server. If the connection is not established, the call will be buffered and sent as soon as it is possible.

-
Parameters:
event - the event name
ack - an acknowledge implementation
args - the arguments
+
Parameters:
event - the event name
ack - an acknowledge implementation
args - arguments. can be any argument JSONArray.put(Object) can take.

@@ -479,7 +538,7 @@

getNamespace

-public java.lang.String getNamespace()
+public String getNamespace()
Gets the namespace. Internally used.

@@ -520,7 +579,7 @@

send

-public void send(java.lang.String message)
+public void send(String message)
Send String data to the Socket.io server.

@@ -534,7 +593,7 @@

send

 public void send(IOAcknowledge ack,
-                 java.lang.String message)
+ String message)
Send JSON data to the Socket.io server.

@@ -586,6 +645,66 @@

not connected or currently connecting

+
+ +

+getTransport

+
+public String getTransport()
+
+
Returns the name of the used transport +

+

+ +
Returns:
the name of the currently used transport
+
+
+
+ +

+getHeaders

+
+public Properties getHeaders()
+
+
Returns the headers used while handshaking. These Properties are not + necessarily the ones set by addHeader(String, String) or + SocketIO(String, Properties) but the ones used for the + handshake. +

+

+ +
Returns:
the headers used while handshaking
+
+
+
+ +

+addHeader

+
+public SocketIO addHeader(String key,
+                          String value)
+
+
Adds an header to the headers +

+

+ +
Returns:
SocketIO.this for daisy chaining.
+
+
+
+ +

+getHeader

+
+public String getHeader(String key)
+
+
Returns the header value +

+

+ +
Returns:
the header value or null if not present
+
+

@@ -616,7 +735,7 @@

PREV CLASS  + PREV CLASS   NEXT CLASS FRAMES   diff --git a/doc/io/socket/SocketIOException.html b/doc/io/socket/SocketIOException.html index 1981b5d..0967a4f 100644 --- a/doc/io/socket/SocketIOException.html +++ b/doc/io/socket/SocketIOException.html @@ -2,12 +2,12 @@ - + SocketIOException - + @@ -55,7 +55,7 @@  PREV CLASS  - NEXT CLASS + NEXT CLASS FRAMES    NO FRAMES   @@ -91,17 +91,17 @@


Class SocketIOException

-java.lang.Object
-  extended by java.lang.Throwable
-      extended by java.lang.Exception
+java.lang.Object
+  extended by java.lang.Throwable
+      extended by java.lang.Exception
           extended by io.socket.SocketIOException
 
-
All Implemented Interfaces:
java.io.Serializable
+
All Implemented Interfaces:
Serializable

-
public class SocketIOException
extends java.lang.Exception
+
public class SocketIOException
extends Exception

@@ -124,14 +124,14 @@

Constructor Summary -SocketIOException(java.lang.String message) +SocketIOException(String message)
          Instantiates a new SocketIOException. -SocketIOException(java.lang.String message, - java.lang.Exception ex) +SocketIOException(String message, + Exception ex)
          Instantiates a new SocketIOException. @@ -150,19 +150,19 @@

  - + - +
Methods inherited from class java.lang.ThrowableMethods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toStringfillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
  - + - +
Methods inherited from class java.lang.ObjectMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  @@ -181,7 +181,7 @@

SocketIOException

-public SocketIOException(java.lang.String message)
+public SocketIOException(String message)
Instantiates a new SocketIOException.

@@ -193,8 +193,8 @@

SocketIOException

-public SocketIOException(java.lang.String message,
-                         java.lang.Exception ex)
+public SocketIOException(String message, + Exception ex)
Instantiates a new SocketIOException.

@@ -232,7 +232,7 @@

 PREV CLASS  - NEXT CLASS + NEXT CLASS FRAMES    NO FRAMES   diff --git a/doc/io/socket/class-use/IOAcknowledge.html b/doc/io/socket/class-use/IOAcknowledge.html index 019ee0e..447d65d 100644 --- a/doc/io/socket/class-use/IOAcknowledge.html +++ b/doc/io/socket/class-use/IOAcknowledge.html @@ -2,12 +2,12 @@ - + Uses of Interface io.socket.IOAcknowledge - + @@ -40,7 +40,7 @@ Package  Class   Use  - Tree  + Tree  Deprecated  Index  Help  @@ -92,22 +92,6 @@

 

- - - - - - - - -
Fields in io.socket with type parameters of type IOAcknowledge
-(package private)  java.util.HashMap<java.lang.Integer,IOAcknowledge>IOConnection.acknowledge - -
-          Acknowledges.
-  -

- @@ -115,20 +99,9 @@

- - - - - @@ -136,9 +109,9 @@

- @@ -155,7 +128,7 @@

- - - - - - - - -
Methods in io.socket with parameters of type IOAcknowledge
 voidIOConnection.emit(SocketIO socket, - java.lang.String event, - IOAcknowledge ack, - java.lang.Object... args) - -
-          emits an event from SocketIO to the IOTransport.
- voidSocketIO.emit(java.lang.String event, +SocketIO.emit(String event, IOAcknowledge ack, - java.lang.Object... args) + Object... args)
          Emits an event to the Socket.IO server.
 voidIOCallback.on(java.lang.String event, +IOCallback.on(String event, IOAcknowledge ack, - java.lang.Object... args) + Object... args)
          On [Event].
 voidIOCallback.onMessage(java.lang.String data, +IOCallback.onMessage(String data, IOAcknowledge ack)
@@ -174,31 +147,11 @@

 void SocketIO.send(IOAcknowledge ack, - java.lang.String message) + String message)
          Send JSON data to the Socket.io server.
- voidIOConnection.send(SocketIO socket, - IOAcknowledge ack, - org.json.JSONObject json) - -
-          sends a JSON message from SocketIO to the IOTransport.
- voidIOConnection.send(SocketIO socket, - IOAcknowledge ack, - java.lang.String text) - -
-          sends a String message from SocketIO to the IOTransport.
 

@@ -217,7 +170,7 @@

Package  Class   Use  - Tree  + Tree  Deprecated  Index  Help  diff --git a/doc/io/socket/class-use/IOCallback.html b/doc/io/socket/class-use/IOCallback.html index 016015d..0a601db 100644 --- a/doc/io/socket/class-use/IOCallback.html +++ b/doc/io/socket/class-use/IOCallback.html @@ -2,12 +2,12 @@ - + Uses of Interface io.socket.IOCallback - + @@ -40,7 +40,7 @@ Package  Class   Use  - Tree  + Tree  Deprecated  Index  Help  @@ -92,22 +92,6 @@

 

- - - - - - - - -
Fields in io.socket declared as IOCallback
-static IOCallbackIOConnection.DUMMY_CALLBACK - -
-          A dummy callback used when IOConnection receives a unexpected message.
-  -

- @@ -139,7 +123,7 @@

- - - - - + diff --git a/doc/io/socket/class-use/SocketIO.html b/doc/io/socket/class-use/SocketIO.html index 9ee5cc2..3090094 100644 --- a/doc/io/socket/class-use/SocketIO.html +++ b/doc/io/socket/class-use/SocketIO.html @@ -2,12 +2,12 @@ - + Uses of Class io.socket.SocketIO - + @@ -40,7 +40,7 @@ - + @@ -94,63 +94,16 @@

Methods in io.socket that return IOCallback
 voidSocketIO.connect(java.lang.String url, +SocketIO.connect(String url, IOCallback callback)
@@ -148,7 +132,7 @@

 voidSocketIO.connect(java.net.URL url, +SocketIO.connect(URL url, IOCallback callback)
@@ -163,14 +147,14 @@

Constructors in io.socket with parameters of type IOCallback
SocketIO(java.lang.String url, +SocketIO(String url, IOCallback callback)
          Instantiates a new socket.io object and connects to the given url.
SocketIO(java.net.URL url, +SocketIO(URL url, IOCallback callback)
@@ -194,7 +178,7 @@

- + - + - - - - - - - - - - - - - - - - - - - - +          Adds an header to the headers
Methods in io.socket with parameters of type SocketIOMethods in io.socket that return SocketIO
- voidIOConnection.emit(SocketIO socket, - java.lang.String event, - IOAcknowledge ack, - java.lang.Object... args) + SocketIOSocketIO.addHeader(String key, + String value)
-          emits an event from SocketIO to the IOTransport.
- voidIOConnection.register(SocketIO socket) - -
-          Connects a socket to the IOConnection.
-static IOConnectionIOConnection.register(java.lang.String origin, - SocketIO socket) - -
-          Creates a new connection or returns the corresponding one.
- voidIOConnection.send(SocketIO socket, - IOAcknowledge ack, - org.json.JSONObject json) - -
-          sends a JSON message from SocketIO to the IOTransport.
- voidIOConnection.send(SocketIO socket, - IOAcknowledge ack, - java.lang.String text) - -
-          sends a String message from SocketIO to the IOTransport.
- voidIOConnection.unregister(SocketIO socket) - -
-          Disconnect a socket from the IOConnection.
  @@ -170,7 +123,7 @@

Package  Class   Use  - Tree  + Tree  Deprecated  Index  Help  diff --git a/doc/io/socket/class-use/SocketIOException.html b/doc/io/socket/class-use/SocketIOException.html index 85f98ed..3d44e62 100644 --- a/doc/io/socket/class-use/SocketIOException.html +++ b/doc/io/socket/class-use/SocketIOException.html @@ -2,12 +2,12 @@ - + Uses of Class io.socket.SocketIOException - + @@ -40,7 +40,7 @@ Package  Class   Use  - Tree  + Tree  Deprecated  Index  Help  @@ -98,14 +98,6 @@

-protected  void -IOConnection.error(SocketIOException e) - -
-          Populates an error to the connected IOCallbacks and shuts down. - - -  void IOCallback.onError(SocketIOException socketIOException) @@ -130,7 +122,7 @@

Package  Class   Use  - Tree  + Tree  Deprecated  Index  Help  diff --git a/doc/io/socket/package-frame.html b/doc/io/socket/package-frame.html index 6d7e033..f17426c 100644 --- a/doc/io/socket/package-frame.html +++ b/doc/io/socket/package-frame.html @@ -2,12 +2,12 @@ - + io.socket - + @@ -25,9 +25,7 @@
IOAcknowledge
-IOCallback -
-IOTransport
+IOCallback @@ -38,15 +36,7 @@ Classes 
-IOConnection -
-IOMessage -
-SocketIO -
-WebsocketTransport -
-XhrTransport
+SocketIO diff --git a/doc/io/socket/package-summary.html b/doc/io/socket/package-summary.html index 2f831cb..1fe2edf 100644 --- a/doc/io/socket/package-summary.html +++ b/doc/io/socket/package-summary.html @@ -2,12 +2,12 @@ - + io.socket - + @@ -95,10 +95,6 @@

IOCallback The Interface IOCallback. - -IOTransport -The Interface IOTransport. -   @@ -110,25 +106,9 @@

Class Summary -IOConnection -The Class IOConnection. - - -IOMessage -The Class IOMessage. - - SocketIO The Class SocketIO. - -WebsocketTransport -The Class WebsocketTransport. - - -XhrTransport -The Class XhrTransport. -   diff --git a/doc/io/socket/package-tree.html b/doc/io/socket/package-tree.html index 064a81f..9e37667 100644 --- a/doc/io/socket/package-tree.html +++ b/doc/io/socket/package-tree.html @@ -2,12 +2,12 @@ - + io.socket Class Hierarchy - + @@ -87,26 +87,19 @@

Class Hierarchy

    -
  • java.lang.Object
    diff --git a/doc/io/socket/package-use.html b/doc/io/socket/package-use.html index 08c9b13..100fbc0 100644 --- a/doc/io/socket/package-use.html +++ b/doc/io/socket/package-use.html @@ -2,12 +2,12 @@ - + Uses of Package io.socket - + @@ -101,18 +101,6 @@

              The Interface IOCallback. -IOConnection - -
    -          The Class IOConnection. - - -IOTransport - -
    -          The Interface IOTransport. - - SocketIO
    diff --git a/doc/overview-tree.html b/doc/overview-tree.html index 3d90842..ea4c9cb 100644 --- a/doc/overview-tree.html +++ b/doc/overview-tree.html @@ -2,12 +2,12 @@ - + Class Hierarchy - + @@ -89,26 +89,19 @@

    Class Hierarchy

      -
    • java.lang.Object
      diff --git a/doc/serialized-form.html b/doc/serialized-form.html index 83cd196..523d0bd 100644 --- a/doc/serialized-form.html +++ b/doc/serialized-form.html @@ -2,12 +2,12 @@ - + Serialized Form - + @@ -40,7 +40,7 @@ Package  Class  Use  - Tree  + Tree  Deprecated  Index  Help  @@ -96,7 +96,7 @@

      +Class io.socket.SocketIOException extends Exception implements Serializable
      -Class io.socket.SocketIOException extends java.lang.Exception implements Serializable
      @@ -121,7 +121,7 @@

      Package  Class  Use  - Tree  + Tree  Deprecated  Index  Help  From 37c33a9ca8a0055246e11307de419acda9dcef1d Mon Sep 17 00:00:00 2001 From: "Enno Boland (Gottox)" Date: Wed, 7 Mar 2012 20:24:07 +0100 Subject: [PATCH 29/29] Add missing javadoc files --- doc/io/socket/AllTests.html | 222 ++++++++++++++++++++++++++ doc/io/socket/class-use/AllTests.html | 142 ++++++++++++++++ 2 files changed, 364 insertions(+) create mode 100644 doc/io/socket/AllTests.html create mode 100644 doc/io/socket/class-use/AllTests.html diff --git a/doc/io/socket/AllTests.html b/doc/io/socket/AllTests.html new file mode 100644 index 0000000..da8bb60 --- /dev/null +++ b/doc/io/socket/AllTests.html @@ -0,0 +1,222 @@ + + + + + + +AllTests + + + + + + + + + + + + +
      + + + + + + + + + + + + + + + + + + + +
      + +
      + + + +
      + +

      + +io.socket +
      +Class AllTests

      +
      +java.lang.Object
      +  extended by io.socket.AllTests
      +
      +
      +
      +
      public class AllTests
      extends java.lang.Object
      + + +

      +


      + +

      + + + + + + + + + + + +
      +Constructor Summary
      AllTests() + +
      +           
      +  + + + + + + + +
      +Method Summary
      + + + + + + + +
      Methods inherited from class java.lang.Object
      clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      +  +

      + + + + + + + + +
      +Constructor Detail
      + +

      +AllTests

      +
      +public AllTests()
      +
      +
      + +
      + + + + + + + + + + + + + + + + + + + +
      + +
      + + + +
      + + + diff --git a/doc/io/socket/class-use/AllTests.html b/doc/io/socket/class-use/AllTests.html new file mode 100644 index 0000000..8c15c7a --- /dev/null +++ b/doc/io/socket/class-use/AllTests.html @@ -0,0 +1,142 @@ + + + + + + +Uses of Class io.socket.AllTests + + + + + + + + + + + + +
      + + + + + + + + + + + + + + + +
      + +
      + + + +
      +
      +

      +Uses of Class
      io.socket.AllTests

      +
      +No usage of io.socket.AllTests +

      +


      + + + + + + + + + + + + + + + +
      + +
      + + + +
      + + +