Let's talk about the data interaction and protocol between the front-end and the back-end

Let's talk about the data interaction and protocol between the front-end and the back-end
[[161047]]

At present, except for some very simple non-Internet applications (such as calculators, alarm clocks, etc.), almost all applications are Internet applications (such as news clients, WeChat, etc.). These app clients are basically only responsible for user interaction and data collection and display. The real data and services are stored in the cloud.

So how does the mobile terminal exchange data with the backend and display it? Let's make an analogy. In fact, the whole process is the same as going to a barbecue restaurant to eat skewers.

Take any news client as an example. When the user refreshes the page (you have the idea of ​​eating barbecue), the client starts to organize data requests (you start to get dressed, wash your face and dress up, and think about which restaurant to go to). When the user interface starts to show loading (at this time you are walking on the way to "Auntie Ma's BBQ Restaurant"), after a few hundred milliseconds, the requested data has reached the server (you are already sitting at the table of Auntie Ma's BBQ Restaurant). The server starts to check what data the client wants to request, whether it is for the financial channel or the car channel (the waiter hands you the menu and asks you what you want to eat). The server understands the client's idea and starts to prepare data (you ordered 20 skewers of meat and 10 kidneys). The server sees that you requested data from the car channel and the financial channel (the shirtless skewers chef starts to grill these 20 skewers and 10 kidneys), and returns it to the waiter. The waiter trots all the way and hands you the skewers and kidneys. At this time, it is equivalent to that the data has been transmitted back to the client, the client loading disappears, and you see the latest data of the two channels.

What is the format of data transmitted between the client and the server?

There are usually two popular practices now. One is to transmit binary data (binary data means that when you open this file, you can only see a string of numbers composed of 0 and 1, which cannot be associated with any letters you know in your life) similar to PB (Protocol Buffer, a data transmission protocol defined by Google, famous for its simplicity, bandwidth saving and ease of use). The advantage of this format is that the package is small and repeated fields are saved. The other is JSON (JavaScript Object Notation), which is also a lightweight data transmission format. It organizes data with a bunch of brackets. Unlike binary, this format is human-readable and relatively lightweight, so it also has a large number of application scenarios. The following data is in JSON format. To put it simply, people corresponds to three people, and the three people are the people in the three curly brackets between the brackets.

To sum up, it is very simple. The mobile terminal makes a request, and the server organizes the data and sends it to you. For different formats, the mobile terminal parses and displays it by itself, and the job is done. In fact, this is not only true for mobile terminals, but also for front-end web pages and back-ends, and between back-ends. As for what happened during the transmission process, we will find an opportunity to talk about it in detail.

<<:  Establishment of internal system of startup companies

>>:  A look at the tech products and services that disappeared in 2015

Recommend

Google releases Android Auto API

Following the announcement of Android Auto in Jun...

Coca-Cola 2020 Christmas advertisement, the most heartwarming work of the year!

There is still a month to go until Christmas, and...

7 Top HTML5 Canvas Animations

HTML5 is indeed a new technology that has revolut...

7 skills you need to acquire as an app operator

As a type of Internet operation , App operation c...

After watching ofo’s new ad, I threw away the client’s brief!

Recently, ofo, the shared yellow bike company, re...

The first developer preview of Android 14

Making Android work well for each of the billions...

What are the channels for publishing articles for free in soft-text marketing?

Soft content marketing is the most common and eff...

Case Study: A Specific App Retention Improvement Analysis Plan

This article mainly uses a case analysis to demon...