Not subscribing to events
Hy im using the 0.1.7 branch from Jitpack.
Currently I have this code and the logs don't display the "socket send event" message.
However I get the message from OkHttp
OkHttp: <-- 101 Switching Protocols https://ws.bitstamp.net/ (147ms)
Which means the handshake was successful, but the connection isn't somehow opened? I also tried commenting out the filter operator without success.
My subscribe code looks like this:
val event = SocketEventFactory.createEvent() val repo = appRepository.observeWebSocketEvent() .filter { it is WebSocket.Event.OnConnectionOpened<*> } .subscribe({ Timber.i("[app] socket send event:%s", event) appRepository.sendEvent(event) }, { e -> Timber.e(e, "[app] socket error") })
I think theres a lifecycle issue, since when I put the app into background and then go back in, the observer receives events. I mean to say that even though I subscribe to the socket in onResume() method, it doesn't get initiated and when I put the app in background and then resume again the sockets start working.