In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "What are the differences between RPC communication and Ajax in Node.js". The explanation in this article is simple and clear, easy to learn and understand. Please follow the ideas of Xiaobian slowly and deeply to study and learn "What are the differences between RPC communication and Ajax in Node.js"!
What is RPC communication precursor
RPC communication is familiar and easy to understand for back-end people, but it is unfamiliar and difficult to understand for front-end people like me. For this problem, let's try to understand RPC communication from the perspective of the front end today.
RPC and Ajax
RPC and Ajax are very similar, and there are many similarities between them. For example:
is communication between two computers.
will agree on data formats.
Differences between RPC and Ajax:
Not necessarily based on DNS as an addressing service
Application layer protocols are generally not HTTP protocols
TCP or UDP based protocols
Let's talk about the differences between them one by one:
1. Ajax uses DNS as the addressing server
The URL that Ajax initiates the request is generally like this, for example: http://domain name/path, but the communication between computers depends on IP rather than domain name, so you need an addressing server to find the IP corresponding to the domain name. Ajax uses DNS as an addressing server. After obtaining the IP address, the browser finds the corresponding server according to the IP address, and then the server returns the data to the browser. The process is as follows:
RPC addresses services through specific servers
RPC is similar to Ajax resolution, but it does not use DNS to address servers, and it uses an ID to find the corresponding IP. For example, Ali's ID is similar to VIP.
2. TCP communication mode
Browsers that use TCP follow the HTTP specification, but RPC uses TCP in a variety of ways:
1. simplex communication
2. half-duplex communication
3. duplex communication
simplex communication
Simplex communication is when only one party in a client-server connection can send messages to the other.
half-duplex communication
Half-duplex communication is when only one party can send messages to the other party during the same time period, and only after the message has been sent can the other party send messages. As shown below:
duplex communication
Duplex communication means that both parties can send messages to each other at any time. As shown below:
Different protocols
Ajax uses the HTTP protocol. RPC communication uses binary protocols. Binary protocol has two main advantages over HTTP protocol, namely:
1. Smaller packet volume (binary data rather than text data)
2. Faster codec speeds (computers encode binary data significantly faster than text data!) Thank you for reading, the above is "Node.js RPC communication and Ajax what the difference" content, after the study of this article, I believe we have a deeper understanding of Node.js RPC communication and Ajax what the difference is, the specific use of the situation also needs to be verified. Here is, Xiaobian will push more articles related to knowledge points for everyone, welcome to pay attention!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.