App and backend communication protocol

Source: Internet
Author: User

There are many common languages, such as English and Chinese, and in the network communication, there are many common protocols, of which HTTP is the most widely used. If it is a private agreement, it can only be designed by itself.


HTTP is the most convenient, if it is a private protocol, including the package and disassembly of the Protocol, the workload, front-end programmers and back-end programmers have to add a lot of extra work. And the private protocol is highly demanding for programmers, and is not suitable for developers who are transferred from a Web site. Unless it's a hands-on tour, it's good to use HTTP.

(2) Does the app and server communicate using long or short connections?


If you call another person's phone by phone now, mobile phone calls are very cheap (or even negligible), but there are two places to note:


1. A mobile phone can only answer a phone at the same time.


2. A mobile phone before answering the phone is very troublesome, to dial, to wait for the answer, it takes a while.


App and server communication using a long connection or a short connection this problem, can be equated with the phone model above, is to keep the call, or if there is a need to dial calls this problem?

2) Does the app and server communicate using long or short connections?


If you call another person's phone by phone now, mobile phone calls are very cheap (or even negligible), but there are two places to note:


1. A mobile phone can only answer a phone at the same time.


2. A mobile phone before answering the phone is very troublesome, to dial, to wait for the answer, it takes a while.


App and server communication using a long connection or a short connection this problem, can be equated with the phone model above, is to keep the call, or if there is a need to dial calls this problem?


When the app and server communication use long connection, it is equivalent to keep the call, the server can maintain a limited number of communications, if the communication is full, then the other apps can not communicate with the service side. This mode of communication, most of the use of sockets or websocket connection for a long time, the requirements of the programmer is relatively high, the development of more difficult, in addition to hand-travel and chat push service, not recommended to use.


When the app and server communicate using a short connection, it's equivalent to dialing calls when needed. This mode of communication, in conjunction with the HTTP protocol, is now the mainstream of communication, the development of high efficiency, there are a large number of third-party resources, using a very broad, recommended use this way.

When the app calls the API, only the following 3 points need to be clarified:


1. What does this API do (in the case of teller machines, the withdrawal function, or the balance, or the transfer)


2. Know what to enter (in the case of teller machines, withdrawals are to be entered into money)


3. Know what the result is (in the case of a teller machine, the withdrawal is a success or failure)


As for how the API is handled internally, the app doesn't need to be ignored.


API, usually called in the form of HTTP, through the HTTP incoming parameters, return the results. The results are generally returned in JSON format, because the JSON format is supported by many computer languages and saves traffic.

App and backend communication protocol

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.