From 6ae700e371d9a082089db87c90f788dac5e22b32 Mon Sep 17 00:00:00 2001 From: Joe Dawson Date: Mon, 10 Dec 2018 14:16:23 +0000 Subject: [PATCH 1/2] add onBackpressureBuffer to Connection.kt --- .../java/com/tinder/scarlet/internal/connection/Connection.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scarlet/src/main/java/com/tinder/scarlet/internal/connection/Connection.kt b/scarlet/src/main/java/com/tinder/scarlet/internal/connection/Connection.kt index 4a51ec72..10d672d9 100644 --- a/scarlet/src/main/java/com/tinder/scarlet/internal/connection/Connection.kt +++ b/scarlet/src/main/java/com/tinder/scarlet/internal/connection/Connection.kt @@ -153,7 +153,7 @@ internal class Connection( } } - fun observeEvent(): Flowable = eventProcessor + fun observeEvent(): Flowable = eventProcessor.onBackpressureBuffer() fun subscribe() { lifecycle.subscribe(lifecycleStateSubscriber) From 0b1258660869fd6f39a3c70bcca5e3d4d4d5254f Mon Sep 17 00:00:00 2001 From: Joe Dawson Date: Tue, 11 Dec 2018 09:54:18 +0000 Subject: [PATCH 2/2] add onBackPressureBuffer to OkHttpWebSocketEventObserver --- .../scarlet/websocket/okhttp/OkHttpWebSocketEventObserver.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scarlet-websocket-okhttp/src/main/java/com/tinder/scarlet/websocket/okhttp/OkHttpWebSocketEventObserver.kt b/scarlet-websocket-okhttp/src/main/java/com/tinder/scarlet/websocket/okhttp/OkHttpWebSocketEventObserver.kt index 1e3e3bb8..09397585 100644 --- a/scarlet-websocket-okhttp/src/main/java/com/tinder/scarlet/websocket/okhttp/OkHttpWebSocketEventObserver.kt +++ b/scarlet-websocket-okhttp/src/main/java/com/tinder/scarlet/websocket/okhttp/OkHttpWebSocketEventObserver.kt @@ -16,7 +16,7 @@ import okio.ByteString internal class OkHttpWebSocketEventObserver : WebSocketListener() { private val processor = PublishProcessor.create().toSerialized() - fun observe(): Flowable = processor + fun observe(): Flowable = processor.onBackpressureBuffer() fun terminate() = processor.onComplete()