This article continues with the previous topic and summarizes the problems encountered during the development process.
The current architecture is as follows:
After the user sets the status of a device on the Web screen, the background processing will save the request to the database (No. 1 ), the process that deals with hardware will monitor the database in real time and immediately process the request (not shown ). At the same time, the client on the Web screen executes a setinterval. after a certain period of time, it starts WebService (No. 2). WebService returns the status of the current device and the request processing status (No. 3 ). The request processing is complete. The latest status is displayed on the screen and clearinterval is enabled.
At first, there was only one request, indicating/setting/monitoring had no problems.
However, after a large number of requests, the problem occurred. Basically, there are the following two phenomena:
1. The request and result do not match
2. The request cannot end
After thinking about WebService calling through JavaScript, WebService does not return the result to JavaScript immediately. The two are not synchronous, but asynchronous.
Therefore, the WebService return value must indicate the request's return value. Otherwise, the request does not match the result, and the request cannot be terminated.
The next article introduces some tips for JavaScript operations on SVG.