Chapter 12. Working with Real-Time Data

In today's app ecosystem, real-time features of various sorts are more or less becoming staple. Chat applications (and chat features for existing apps) are ever more common, push notifications bring news and views to users without them having to look for it, and so on.

In this chapter, we will take a look at how we can incorporate some choice real-time features into our Ionic apps. We will do so by building a simple chat application without authentication, where at least two people can get together and talk about the wonders of life. In doing so, we will revisit what we learnt earlier about web sockets, as we will need to create a simple server for this end.

A refresher – WebSockets

Before we move on, let's have a quick refresher on an important concept that we visited earlier—WebSockets.

WebSockets is a standardized Internet protocol, which allows for direct server-to-client communication over a network. This is rather unusual in the world of traditional client-server architecture, where almost all communication is initiated by the client and the server simply responds to such communication.

WebSockets makes it easy to build real-time apps because the server can dynamically push new data to the connected clients as soon as its state changes. This is ideal for chat applications, in which we would otherwise have to use more tedious and resource-consuming approaches, such as polling, in order to approximate the same effect.

For a deeper understanding of WebSockets, please refer to Chapter 5, Real-Time Data and WebSockets, where we dealt with them in depth.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.14.131.212