Receiving messages in our ViewModel
Our app is ready to receive and send messages using a WebSocket. Now, we need to make them reach the UI we created in the previous chapter. We will do that in this section, but first, we need to think about the architecture and components needed to do that.
Understanding Clean Architecture implementation
In the previous chapter, we modularized our app and talked about using a Clean Architecture-based structure to organize our common and feature modules. We have already created our first component of this architecture, MessagesWebsocketDataSource
, but it is important to understand the reasons behind this organization and which role every component plays in the architecture.
There are extensive books, articles, and videos about why and how to apply Clean Architecture principles to an Android app, even from official documentation by Google. Here, we are going to give you a short description and then break down into its layers.
Clean Architecture...