Skip to content

Commit a4c4521

Browse files
committed
docs: update README
1 parent 40fb72c commit a4c4521

File tree

1 file changed

+26
-11
lines changed

1 file changed

+26
-11
lines changed

README.md

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# RxSocketClient
22

3-
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/codeestX/RxSocketClient/pulls) [![API](https://img.shields.io/badge/API-20%2B-brightgreen.svg)](https://android-arsenal.com/api?level=20) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
3+
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/codeestX/RxSocketClient/pulls) [![API](https://img.shields.io/badge/API-20%2B-brightgreen.svg)](https://android-arsenal.com/api?level=20) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)[![](https://jitpack.io/v/codeestX/RxSocketClient.svg)](https://jitpack.io/#codeestX/RxSocketClient)
44

55
RxSocketClient, Reactive Socket APIs for Android, Java and Kotlin, powered by RxJava2
66
RxSocketClient,支持Android,Java和Kotlin的响应式Socket APIs封装,基于RxJava2
@@ -9,6 +9,21 @@ RxJava2 Version: 2.1.1
99

1010
# Usage
1111

12+
Step 1. Add the JitPack repository to your build file
13+
14+
allprojects {
15+
repositories {
16+
...
17+
maven { url "https://jitpack.io" }
18+
}
19+
}
20+
21+
Step 2. Add the dependency
22+
23+
dependencies {
24+
compile 'com.github.codeestX:RxSocketClient:v1.0.0'
25+
}
26+
1227
### init
1328
```java
1429
SocketClient mClient = RxSocketClient
@@ -40,33 +55,33 @@ SocketClient mClient = RxSocketClient
4055
### connect
4156
```java
4257
Disposable ref = mClient.connect()
43-
... // anything else what you can do with RxJava
58+
... // anything else what you can do with RxJava
4459
.observeOn(AndroidSchedulers.mainThread())
4560
.subscribe(new SocketSubscriber() {
4661
@Override
4762
public void onConnected() {
48-
//onConnected
63+
//onConnected
4964
Log.e(TAG, "onConnected");
5065
}
5166

5267
@Override
5368
public void onDisconnected() {
54-
//onDisconnected
69+
//onDisconnected
5570
Log.e(TAG, "onDisconnected");
5671
}
5772

5873
@Override
5974
public void onResponse(@NotNull byte[] data) {
60-
//receive data
75+
//receive data
6176
Log.e(TAG, Arrays.toString(data));
6277
}
6378
}, new Consumer<Throwable>() {
64-
@Override
65-
public void accept(Throwable throwable) throws Exception {
66-
//onError
67-
Log.e(TAG, throwable.toString());
68-
}
69-
});
79+
@Override
80+
public void accept(Throwable throwable) throws Exception {
81+
//onError
82+
Log.e(TAG, throwable.toString());
83+
}
84+
});
7085
```
7186

7287
### disconnect

0 commit comments

Comments
 (0)