The company recently took on a project, which is to use H5 to develop an app to control hardware, such as refrigerators, water heaters and other equipment. I have never done this before. I would like to know what the interface written in the background looks like during development. , what needs to be done to call the background interface to achieve the purpose of controlling the device
The interface is generally Android
Just request data from the server through the network protocol, the same principle as the web page. The network protocol can be http, socket or mqtt
I suggest you take a look at the interfaces of Alibaba Smart and JD Weilian. They now control hardware through mobile phones. The interface is very simple, just copy it and it will be fine.
Interface communication is implemented through ajax. Normal operations are the same as web page operations. However, you should pay attention to whether there are cross-domain problems. Generally, they are the same. It's nothing more than transmitting data to and retrieving data from the background. Don't think about it too complicated.
H5 supports
websocket
real-time communicationbackend interface using
JSON
format data transmissionInterface communication is implemented through ajax. Normal operations are the same as web page operations. However, you should pay attention to whether there are cross-domain problems. Generally, they are the same. It's nothing more than transmitting data to and retrieving data from the background. Don't think about it too complicated.