The pictures in the browser show that the car is driving
The general process is as follows:
First, the real-time location and video data collected by the two cameras are transmitted to the server during the vehicle driving process. Then, the Server communicates with the browser through the websocket protocol, that is, the status is displayed on the browser page.
Technologies used:
1. Use Flask-Socketio for websocket Communication
Flask-Socketio is the Flask plug-in of Socketio. io is very similar. Based on Asynchronous processing of various events, you can choose to use the following asynchronous services: eventlet, gevent, and Werkzeug that comes with Flask.
1. Let the server send data to the client
Without client requests, a permanent connection can be created with only one handshake, allowing bidirectional transmission.
2. Specific Process
Initialization:
Socketio = SocketIO (app) Listening event:Socketio. on: send messages using send () or emit (), send () for unnamed events, and emit () for named events (). Namespace: allows the client and server to establish multiple connections through the same socket. If this parameter is not specified, the default namespce is used. Room: If a room is specified for an event, only connections in the same room can receive the event. Each connection belongs to a room named request. sid by default.
2. Draw flickering dots
1. First cache the canvas image to the temporary canvas
2. Clear the image on the main canvas
3. Draw a new circle on the canvas
4. After the new circle is drawn, draw the temporary canvas image back to the main canvas.