@@ -100,115 +100,6 @@ For further informations, read the [Javadoc](http://s01.de/~tox/hgexport/socket.
100100 * [ Class SocketIO] ( http://s01.de/~tox/hgexport/socket.io-java-client/io/socket/SocketIO.html )
101101 * [ Interface IOCallback] ( http://s01.de/~tox/hgexport/socket.io-java-client/io/socket/IOCallback.html )
102102
103- ## Internals
104-
105- Read this if you want to investigate in socket.io-java-client.
106-
107- ![ Schema] ( https://github.com/Gottox/socket.io-java-client/raw/master/doc/schema.png )
108-
109- ### What is the SocketIO class?
110-
111- SocketIO is the API frontend. You can use this to connect to multiple hosts. If an
112- * IOConnection* object exists for a certian host, it will be reused as the
113- socket.io specs state.
114-
115- [ Javadoc] ( http://s01.de/~tox/hgexport/socket.io-java-client/io/socket/SocketIO.html )
116-
117- ### What is the IOConnection class?
118-
119- This class is used to hold a connection to a socket.io server. It handles calling
120- callback functions of the corresponding * SocketIO* and reconnecting if the connection
121- is shut down ungracefully.
122-
123- [ Javadoc] ( http://s01.de/~tox/hgexport/socket.io-java-client/io/socket/IOConnection.html )
124-
125- ### What is the IOTransport interface?
126-
127- This interface describes a connection to a host. The implementation can be fairly minimal,
128- as * IOConnection* does most of the work for you. Reconnecting, errorhandling, etc... is
129- handled by * IOConnection* .
130-
131- [ Javadoc] ( http://s01.de/~tox/hgexport/socket.io-java-client/io/socket/IOTransport.html )
132-
133- ## How to implement a transport?
134-
135- An example can be found in [ WebsocketTransport.java] ( http://github.com/Gottox/socket.io-java-client/blob/master/src/io/socket/XhrTransport.java )
136- or [ XhrTransport.java] ( http://github.com/Gottox/socket.io-java-client/blob/master/src/io/socket/XhrTransport.java )
137- Create a class implementing the IOTransport interface.
138-
139- ### IOTransport
140-
141- #### public static final String TRANSPORT_NAME
142- This constant should contain the name of the transport.
143-
144- #### static IOTransport create(URL url, IOConnection connection)
145-
146- Called by IOConnector to create a new Instance of the transport. The URL is the one you should connect to. Here you can rewrite the
147- url if needed, i.e. WebsocketTransport rewrites the incoming "http://" address to "ws://"
148-
149- #### void connect();
150-
151- Called by IOConnection. Here you should set up the connection.
152-
153- #### void disconnect();
154-
155- Called by IOConnection. This should shut down the connection. I'm currently not sure if this function is called multiple times.
156- So make sure, it doesn't crash if it's called more than once.
157-
158- #### void send(String text) throws IOException;
159-
160- Called by IOConnection. This call request you to send data to the server.
161-
162- #### boolean canSendBulk();
163-
164- If you can send more than one message at a time, return true. If not return false.
165-
166- #### void sendBulk(String[ ] texts) throws IOException;
167-
168- Basicly the same as send() but for multiple messages at a time. This is only called when canSendBulk returns true.
169-
170- #### void invalidate();
171-
172- After this call, the transport should not call any methods of IOConnection. It must not disconnect from the server.
173- This is the case when we're forcing a reconnect. If we disconnect gracefully from the server, it will terminate our
174- session.
175-
176- ### IOConnection
177-
178- Ok, now we know when our functions are called. But how do we tell socket.io-java-client to process messages we get?
179- The provided IOConnection does the trick.
180-
181- #### IOConnection.transportConnect()
182-
183- Call this method when the connection is established an the socket is ready to send and receive data.
184-
185- #### IOConnection.transportDisconnected()
186-
187- Call this method when the connection is shot down. IOConnection will care about reconnecting, if it's feasibility.
188-
189- #### IOConnection.transportError(Exception error)
190-
191- Call this method when the connection is experiencing an error. IOConnection will take care about reconnecting or throwing an
192- error to the callbacks. Whatever makes more sense ;)
193-
194- #### IOConnection.transportMessage(String message)
195-
196- This should be called as soon as the transport has received data. IOConnection will take care about parsing the information and
197- calling the callbacks of the sockets.
198-
199- ### Changes to IOConnection
200-
201- Now IOConnection needs to instantiate the transpost look at the sourcecode of IOConnection and search for the connectTransport() method.
202- It's part of the ConnectThread inner class.
203-
204- add a new else if branch to the section. I.e.:
205-
206- ``` java
207- ...
208- else if (protocols. contains(MyTransport . TRANSPORT_NAME ))
209- transport = MyTransport . create(url, IOConnection . this );
210- ...
211- ```
212103## Frameworks
213104
214105This Library was designed with portability in mind.
@@ -219,7 +110,6 @@ This Library was designed with portability in mind.
219110* __ JavaME__ untested.
220111* ... is there anything else out there?
221112
222-
223113## Testing
224114
225115There comes a JUnit test suite with socket.io-java-client. Currently it's tested with Eclipse.
0 commit comments