Skip to content

Commit 0348606

Browse files
committed
Fix example
1 parent 0b18b86 commit 0348606

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

example-client/src/main/java/ua/naiksoftware/stompclientexample/ExampleRepository.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package ua.naiksoftware.stompclientexample;
22

3+
import io.reactivex.Completable;
34
import io.reactivex.Flowable;
45
import retrofit2.http.POST;
56
import retrofit2.http.Query;
@@ -10,5 +11,5 @@
1011
public interface ExampleRepository {
1112

1213
@POST("hello-convert-and-send")
13-
Flowable<Void> sendRestEcho(@Query("msg") String message);
14+
Completable sendRestEcho(@Query("msg") String message);
1415
}

example-client/src/main/java/ua/naiksoftware/stompclientexample/MainActivity.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,13 @@
1111
import com.google.gson.Gson;
1212
import com.google.gson.GsonBuilder;
1313

14-
import org.java_websocket.WebSocket;
15-
1614
import java.text.SimpleDateFormat;
1715
import java.util.ArrayList;
1816
import java.util.Date;
1917
import java.util.List;
2018
import java.util.Locale;
2119

22-
import io.reactivex.FlowableTransformer;
20+
import io.reactivex.CompletableTransformer;
2321
import io.reactivex.android.schedulers.AndroidSchedulers;
2422
import io.reactivex.disposables.Disposable;
2523
import io.reactivex.schedulers.Schedulers;
@@ -56,7 +54,7 @@ public void disconnectStomp(View view) {
5654
}
5755

5856
public void connectStomp(View view) {
59-
mStompClient = Stomp.over(WebSocket.class, "ws://" + ANDROID_EMULATOR_LOCALHOST
57+
mStompClient = Stomp.over(Stomp.ConnectionProvider.JWS, "ws://" + ANDROID_EMULATOR_LOCALHOST
6058
+ ":" + RestClient.SERVER_PORT + "/example-endpoint/websocket");
6159

6260
mStompClient.lifecycle()
@@ -91,7 +89,7 @@ public void connectStomp(View view) {
9189
public void sendEchoViaStomp(View v) {
9290
mStompClient.send("/topic/hello-msg-mapping", "Echo STOMP " + mTimeFormat.format(new Date()))
9391
.compose(applySchedulers())
94-
.subscribe(aVoid -> {
92+
.subscribe(() -> {
9593
Log.d(TAG, "STOMP echo send successfully");
9694
}, throwable -> {
9795
Log.e(TAG, "Error send STOMP echo", throwable);
@@ -103,7 +101,7 @@ public void sendEchoViaRest(View v) {
103101
mRestPingDisposable = RestClient.getInstance().getExampleRepository()
104102
.sendRestEcho("Echo REST " + mTimeFormat.format(new Date()))
105103
.compose(applySchedulers())
106-
.subscribe(aVoid -> {
104+
.subscribe(() -> {
107105
Log.d(TAG, "REST echo send successfully");
108106
}, throwable -> {
109107
Log.e(TAG, "Error send REST echo", throwable);
@@ -122,8 +120,8 @@ private void toast(String text) {
122120
Toast.makeText(this, text, Toast.LENGTH_SHORT).show();
123121
}
124122

125-
protected <T> FlowableTransformer<T, T> applySchedulers() {
126-
return tFlowable -> tFlowable
123+
protected CompletableTransformer applySchedulers() {
124+
return upstream -> upstream
127125
.unsubscribeOn(Schedulers.newThread())
128126
.subscribeOn(Schedulers.io())
129127
.observeOn(AndroidSchedulers.mainThread());

lib/src/main/java/ua/naiksoftware/stomp/client/StompClient.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ public void connect(@Nullable List<StompHeader> _headers) {
132132
.subscribe(stompMessage -> {
133133
mConnected = true;
134134
isConnecting = false;
135-
// mConnectionFuture.complete(true);
136135
});
137136
}
138137

0 commit comments

Comments
 (0)