Chapter 12. Advanced architectures: Chat client 2
In this chapter
- Pending messages status for chat client
- Stores with multiple inputs
- Initializing a store from a REST API
- Model layer as a container for business logic
We touched on the topic of a store in an earlier chapter. It’s a powerful tool for isolating state in a place that can be easily identified and maintained.
In this chapter, you’ll expand the working chat client to use a store for greater flexibility. In the preceding chapter, you put everything into one big view model, and although this worked, it doesn’t scale too far.
In addition to a store, you’ll create a layer around the store that can handle business logic universal to the application. Normally, this layer is called the model, but you’ll get to that later.
To quickly remind yourself of what is in the chat client, let’s look at the UI so far. It has a list of messages, a text input, and a button to send a message (to be received by other connected clients).
It’s not a complicated piece of software as a whole, and for our purposes that’s a good thing. Seeing patterns is usually easier when you have less code to distract from the core functionality of the application.