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

Wang Jianlin's e-commerce dream is hidden in Wanda Commercial Real Estate

Do you still remember the news that Wang Jianlin,...

The latest method to attract traffic and promote Toutiao today!

Why choose Toutiao ? Yesterday I saw someone aske...

Amap's major features are now available for free

On May 17, Amap published an open letter to every...

Why do humans have menopause? Do animals have menopause?

We have observed a strange phenomenon: most anima...

How was your App Store last night?

Last night, you may have been unable to connect t...

Youtube video marketing and keyword search!

Four major benefits of YouTube video marketing : ...

Letting your child become a "conspicuous bag" actually has such benefits?

Review expert: Chen Mingxin, national second-leve...

How to build an online operation and promotion system?

How to build a comprehensive online operation and...

Excellent! The driver's scientific operation saved 19 passengers!

Recently, Zhuzhou, Hunan Beijing-Hong Kong-Macao ...

Killer whales and dolphins: Stupid humans, come in and chat for five cents?

There are many happy elves living in the vast oce...

How to rent a high-defense server?

How to rent a high-defense server? A high-defense...

Twelve sentences reveal that you are a miserable PR dog!

Just one sentence can expose you as a PR dog! &qu...