diff --git a/.classpath b/.classpath index 582029f..71ba817 100644 --- a/.classpath +++ b/.classpath @@ -4,7 +4,11 @@ - + + + + + diff --git a/.gitignore b/.gitignore deleted file mode 100644 index e660fd9..0000000 --- a/.gitignore +++ /dev/null @@ -1 +0,0 @@ -bin/ 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/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/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/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 +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + 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  diff --git a/src/io/socket/IOConnection.java b/src/io/socket/IOConnection.java index 0763916..70231a1 100644 --- a/src/io/socket/IOConnection.java +++ b/src/io/socket/IOConnection.java @@ -17,9 +17,9 @@ import java.util.HashMap; import java.util.LinkedList; import java.util.List; +import java.util.Map.Entry; import java.util.Properties; import java.util.Scanner; -import java.util.Set; import java.util.Timer; import java.util.TimerTask; import java.util.concurrent.ConcurrentLinkedQueue; @@ -90,6 +90,9 @@ class IOConnection { /** The sockets of this connection. */ private HashMap sockets = new HashMap(); + /** Custom Request headers used while handshaking */ + private Properties headers; + /** * The first socket to be connected. the socket.io server does not send a * connected response to this one. @@ -171,30 +174,12 @@ public void run() { * {@link IOTransport} */ private class ConnectThread extends Thread { - - /** Custom Request headers used while handshaking */ - private Properties headers = new Properties(); - - /** - * Instantiates a new background thread. + * Instantiates a new thread for handshaking/connecting. */ public ConnectThread() { super("ConnectThread"); } - - /** - * Instantiates a new background thread passing the header - * will be used while handshaking. - * - * @param headers - * the headers will be used while handshaking - */ - public ConnectThread(Properties headers) { - this(); - if ( headers != null ) - this.headers = headers; - } /** * Tries handshaking if necessary and connects with corresponding @@ -221,14 +206,11 @@ private void handshake() { connection = url.openConnection(); connection.setConnectTimeout(connectTimeout); connection.setReadTimeout(connectTimeout); - + /* Setting the request headers */ - if ( ! this.headers.isEmpty() ){ - Set keys = this.headers.keySet(); - for ( Object key : keys ){ - String k = (String) key; - connection.setRequestProperty( k , this.headers.getProperty(k) ); - } + for (Entry entry : headers.entrySet()) { + connection.setRequestProperty((String) entry.getKey(), + (String) entry.getValue()); } InputStream stream = connection.getInputStream(); @@ -360,13 +342,9 @@ private IOConnection(String url, SocketIO socket) { throw new RuntimeException(e); } firstSocket = socket; + headers = socket.getHeaders(); sockets.put(socket.getNamespace(), socket); - - Properties h = socket.getHeaders(); - if ( h.isEmpty() ) - new ConnectThread().start(); - else - new ConnectThread( h ).start(); + new ConnectThread().start(); } /** @@ -394,13 +372,12 @@ public boolean register(SocketIO socket) { String namespace = socket.getNamespace(); if (sockets.containsKey(namespace)) return false; - else { - sockets.put(namespace, socket); - IOMessage connect = new IOMessage(IOMessage.TYPE_CONNECT, - socket.getNamespace(), ""); - sendPlain(connect.toString()); - return true; - } + sockets.put(namespace, socket); + socket.setHeaders(headers); + IOMessage connect = new IOMessage(IOMessage.TYPE_CONNECT, + socket.getNamespace(), ""); + sendPlain(connect.toString()); + return true; } /** diff --git a/src/io/socket/SocketIO.java b/src/io/socket/SocketIO.java index 129859c..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; /** @@ -21,16 +22,15 @@ public class SocketIO { /** callback of this Socket. */ private IOCallback callback; - + /** connection of this Socket. */ private IOConnection connection; /** namespace. */ private String namespace; - + /** Used for setting header during handshaking. */ - private Properties headers; - + private Properties headers = new Properties(); private URL url; @@ -40,7 +40,7 @@ public class SocketIO { * {@link #connect(String, IOCallback)} */ public SocketIO() { - this.headers = new Properties(); + } /** @@ -57,12 +57,11 @@ public SocketIO(final String url) throws MalformedURLException { throw new RuntimeException("url may not be null."); setAndConnect(new URL(url), null); } - - + /** - * Instantiates a new socket.io connection and sets the request headers - * used while connecting the first time for authorizing. - * The object connects after calling {@link #connect(IOCallback)} + * Instantiates a new socket.io connection and sets the request headers used + * while connecting the first time for authorizing. The object connects + * after calling {@link #connect(IOCallback)} * * @param url * the url @@ -71,13 +70,14 @@ public SocketIO(final String url) throws MalformedURLException { * @throws MalformedURLException * the malformed url exception */ - public SocketIO(final String url, Properties headers) throws MalformedURLException { + public SocketIO(final String url, Properties headers) + throws MalformedURLException { if (url == null) throw new RuntimeException("url may not be null."); - - if ( headers != null ) + + if (headers != null) this.headers = headers; - + setAndConnect(new URL(url), null); } @@ -219,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); @@ -235,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) { @@ -340,31 +340,53 @@ public String getTransport() { IOTransport transport = this.connection.getTransport(); return transport != null ? transport.getName() : null; } - + /** - * Returns the headers used while handshaking + * Returns the headers used while handshaking. These Properties are not + * necessarily the ones set by {@link #addHeader(String, String)} or + * {@link #SocketIO(String, Properties)} but the ones used for the + * handshake. * * @return the headers used while handshaking */ public Properties getHeaders() { - return this.headers; + return headers; } - + + /** + * Sets the headers used while handshaking. Internally used. Use + * {@link #SocketIO(String, Properties)} or + * {@link #addHeader(String, String)} instead. + * + * @param headers + * the headers used while handshaking + */ + void setHeaders(Properties headers) { + this.headers = headers; + } + /** * Adds an header to the {@link #headers} + * @return SocketIO.this for daisy chaining. */ - public void addHeader(String key, String value){ - this.headers.setProperty( key, 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; } - + /** * Returns the header value * * @return the header value or {@code null} if not present */ - public String getHeader(String key){ - if ( this.headers.contains(key) ) - return this.headers.getProperty( key ); + public String getHeader(String key) { + if (this.headers.contains(key)) + return this.headers.getProperty(key); return null; } }