Taming websockets with Coroutines, Clean Architecture and a library

Websocket integration is one of the biggest issues I had in my whole experience with Android. Why is it such a huge pain? There are several reasons behind that:

  1. Connection should remain stable no matter what – and we know how complex the Android lifecycle can be.
  2. Sending data can be a one-way operation without giving any result – did you succeed in sending it or did you fail? Only Server knows.
  3. Retrying connection or network requests can be tricky to implement – from pushing logic to interactors to having an internal logic inside a repository, be sure – nothing will work at 100%. Not even at 90% either.
  4. To get it right you need both frontend and backend collaboration. Nothing can be done if both sides do it separated from each other.
Continue reading “Taming websockets with Coroutines, Clean Architecture and a library”

Applying Clean Architecture in Android

Short Intro

For 4 months now I have been implementing “clean architecture” in my current project. The project is huge, more than 17 Android developers work on it including me, so it is important to apply an architecture that works for all of us. I will not talk about what “clean architecture” is, but I will directly dive into the code and explain step by step the purpose of the layers that we have and what each layer is about.

Continue reading “Applying Clean Architecture in Android”