Skip to content

Commit

Permalink
Fix unsubscribe
Browse files Browse the repository at this point in the history
  • Loading branch information
Nickolay Savchenko committed Feb 7, 2019
1 parent 1003a32 commit e71248f
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions lib/src/main/java/ua/naiksoftware/stomp/StompClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,7 @@ public Completable send(String destination, String data) {
public Completable send(@NonNull StompMessage stompMessage) {
Completable completable = connectionProvider.send(stompMessage.compile(legacyWhitespace));
CompletableSource connectionComplete = getConnectionStream()
// .filter(isConnected -> isConnected)
.filter(isConnected -> {
Log.d(TAG, "Send " + stompMessage + "filtered " + isConnected);
return isConnected;
})
.filter(isConnected -> isConnected)
.firstElement().ignoreElement();
return completable
.startWith(connectionComplete);
Expand Down Expand Up @@ -248,8 +244,7 @@ else if (!streamMap.containsKey(destPath))
getMessageStream()
.filter(msg -> pathMatcher.matches(destPath, msg))
.toFlowable(BackpressureStrategy.BUFFER)
.doFinally(() -> unsubscribePath(destPath).subscribe())
.share())
.share()).doFinally(() -> unsubscribePath(destPath).subscribe())
);
return streamMap.get(destPath);
}
Expand Down

0 comments on commit e71248f

Please sign in to comment.