@@ -8,12 +8,11 @@ But if you're looking for a raw Socket, HTTP(s) client/server, and WebSocket lib
8
8
is it.
9
9
10
10
#### Features
11
- * Based on NIO. One thread, driven by callbacks. Highly efficient .
11
+ * Based on NIO. Single threaded and callback driven .
12
12
* All operations return a Future that can be cancelled
13
13
* Socket client + socket server
14
14
* HTTP client + server
15
15
* WebSocket client + server
16
- * Socket.IO client
17
16
18
17
### Download
19
18
@@ -107,7 +106,8 @@ AsyncHttpClient.getDefaultInstance().getFile(url, filename, new AsyncHttpClient.
107
106
### Caching is supported too
108
107
109
108
``` java
110
- // arguments are the http client, the directory to store cache files, and the size of the cache in bytes
109
+ // arguments are the http client, the directory to store cache files,
110
+ // and the size of the cache in bytes
111
111
ResponseCacheMiddleware . addCache(AsyncHttpClient . getDefaultInstance(),
112
112
getFileStreamPath(" asynccache" ),
113
113
1024 * 1024 * 10 );
@@ -164,39 +164,6 @@ AsyncHttpClient.getDefaultInstance().websocket(get, "my-protocol", new WebSocket
164
164
```
165
165
166
166
167
- ### AndroidAsync also supports socket. io (version 0.9 . x)
168
-
169
- ```java
170
- SocketIOClient . connect(AsyncHttpClient . getDefaultInstance(), " http://192.168.1.2:3000" , new ConnectCallback () {
171
- @Override
172
- public void onConnectCompleted (Exception ex , SocketIOClient client ) {
173
- if (ex != null ) {
174
- ex. printStackTrace();
175
- return ;
176
- }
177
- client. setStringCallback(new StringCallback () {
178
- @Override
179
- public void onString (String string ) {
180
- System . out. println(string);
181
- }
182
- });
183
- client. on(" someEvent" , new EventCallback () {
184
- @Override
185
- public void onEvent (JSONArray argument , Acknowledge acknowledge ) {
186
- System . out. println(" args: " + arguments. toString());
187
- }
188
- });
189
- client. setJSONCallback(new JSONCallback () {
190
- @Override
191
- public void onJSON (JSONObject json ) {
192
- System . out. println(" json: " + json. toString());
193
- }
194
- });
195
- }
196
- });
197
- ```
198
-
199
-
200
167
### AndroidAsync also let' s you create simple HTTP servers:
201
168
202
169
```java
@@ -221,17 +188,12 @@ server.listen(5000);
221
188
222
189
```java
223
190
AsyncHttpServer httpServer = new AsyncHttpServer();
224
- httpServer.setErrorCallback(new CompletedCallback() {
225
- @Override
226
- public void onCompleted(Exception ex) {
227
- Log.e("WebSocket", "An error occurred", ex);
228
- }
229
- });
230
- httpServer.listen(AsyncServer.getDefault(), port);
231
191
232
- httpServer.websocket("/live", new AsyncHttpServer.WebSocketRequestCallback() {
233
- @Override
234
- public void onConnected(final WebSocket webSocket, AsyncHttpServerRequest request) {
192
+ httpServer.listen(AsyncServer.getDefault(), port);
193
+
194
+ httpServer.websocket("/live", new AsyncHttpServer.WebSocketRequestCallback() {
195
+ @Override
196
+ public void onConnected(final WebSocket webSocket, AsyncHttpServerRequest request) {
235
197
_sockets.add(webSocket);
236
198
237
199
//Use this to clean up any references to your websocket
@@ -296,7 +258,3 @@ client.getString("http://foo.com/hello.txt")
296
258
}
297
259
});
298
260
```
299
-
300
- ### Note on SSLv3
301
-
302
- https://github.com/koush/AndroidAsync/issues/174
0 commit comments