javascript - In addition to ajax, what else can be used to call the backend interface from the front end?
仅有的幸福2017-06-30 09:57:52
0
4
1168
The company wants to build a mobile official website and cannot use ajax to call the interface (in order to capture data for others), so what else can be used? ? ? What does Baidu use to capture data?
You can make a WebSocket middleware and use the middleware to forward the interface. This has several benefits:
No need to repeat requests multiple times, which can speed up browser execution efficiency
The browser has a limit on the number of AJAX requests initiated simultaneously under the same domain name, while WebSocket only requires one connection, and the browser has no limit on the number of WebSocket connections
Using WebSocket, you can not only request server data. When other users operate on data on the server elsewhere, you can also push updated content to all front-end parts that are browsing this page through WebSocket broadcast, allowing data modification and browsing. Instant sync
You can use fetch....
Link description
It depends on what protocol the interface uses
Some interfaces can also be adjusted using php’s curl
You can make a WebSocket middleware and use the middleware to forward the interface. This has several benefits:
No need to repeat requests multiple times, which can speed up browser execution efficiency
The browser has a limit on the number of AJAX requests initiated simultaneously under the same domain name, while WebSocket only requires one connection, and the browser has no limit on the number of WebSocket connections
Using WebSocket, you can not only request server data. When other users operate on data on the server elsewhere, you can also push updated content to all front-end parts that are browsing this page through WebSocket broadcast, allowing data modification and browsing. Instant sync
webservice, websocket-based, page http