Setting Up WhatsPackt’s Messaging Abilities
In the previous chapter, we created the structure and UI needed for our messaging app, WhatsPackt.
One of the core features of any messaging app is the ability to facilitate 1:1 conversations between two users, so in this chapter, we will delve into the process of connecting our messaging app to a backend server using WebSockets, handling messages within ViewModel
instances, and managing synchronization, error handling, and push notifications.
We will begin by exploring WebSockets, a powerful technology that enables bidirectional communication between client and server, providing a solid foundation for real-time messaging in your app. You will learn how to establish a WebSocket connection, send messages, and handle incoming messages from the server.
Next, we will demonstrate how to receive messages in your ViewModel. We will discuss best practices for updating the UI, managing message storage, and handling user interactions...