Long connection method for vehicle ends

By establishing a TCP connection between the vehicle-side device and the server, using preset format frames and heartbeat Pong frames, the traffic consumption problem of the WebSocket long connection method during high-frequency message push and data upload is solved, reducing the transformation cost and Improved flexibility of information exchange.

CN118677964APending Publication Date: 2024-09-20TONGCHENG NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410811723.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-21
Publication Date
2024-09-20

AI Technical Summary

Technical Problem

The existing WebSocket long-connection method of vehicle-side devices consumes a lot of traffic in scenarios where a large number of messages are pushed and data is uploaded, and the cost of replacing it with other low-traffic protocols is high.

Method used

Adopting a long connection method for the car side, by establishing a TCP connection between the device side and the server side, using preset format login frames and positioning frames for login verification and data upload, combined with the syntax multiplexing of heartbeat Pong frames, to reduce traffic consumption And compatible with existing WebSocket protocol.

Benefits of technology

It reduces the traffic consumption when establishing a long connection, reduces the transformation cost of the WebSocket protocol, improves the flexibility of information interaction, meets the information interaction needs of different scenarios, and reduces the time of message push and data upload when realizing the reminder to get on and off the car function. flow.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118677964A
    Figure CN118677964A
Patent Text Reader

Abstract

The invention provides a long connection method for a vehicle end, which comprises the following steps that: TCP (Transmission Control Protocol) connection between a device end and a server end is established, the server end judges whether the device end logs in successfully based on a login frame sent by the device end and sends a heartbeat Pong frame to the device end when the device end logs in successfully, and the device end uploads a positioning frame to the server end when receiving the heartbeat Pong frame, and the server calls the vehicle positioning information contained in the positioning frame back to the service system for processing, and the service system notifies the server to push a reminding message to the equipment when the vehicle corresponding to the equipment approaches the station. By adopting the method and the device, the problems of large traffic consumption and high WebSocket protocol replacement cost in the WebSocket long connection mode of the existing vehicle-end equipment can be relieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of communication technology, and in particular to a long connection method for a vehicle end. Background Art

[0002] In order to increase transmission speed and save traffic, Internet products will use persistent connection technology to implement message push and real-time data upload on the device side. There are generally two common persistent connection methods: one is the http persistent connection initiated by the device side to the backend (i.e., the server side). This method requires the device side to poll the server side, does not support real-time message push on the server side, consumes a lot of traffic, and has low requirements for network stability; the other is the persistent connection using the WebSocket protocol, which supports real-time message push on the server side and consumes less traffic than the previous method.

[0003] With the development of the Internet, many vehicles are equipped with on-board devices to assist passengers in payment and drivers in checking routes. Some devices can also provide drivers with functions such as confirming seat ticket purchases, checking the location of the vehicle and other vehicles in the fleet, and reminding drivers to get on and off the vehicle. These functions make the message push and data upload of on-board devices more frequent. Usually, a WebSocket persistent connection is established on the vehicle-side device to achieve message push and data upload on the vehicle-side device. Therefore, the existing WebSocket persistent connection method for vehicle-side devices has the following two problems:

[0004] (1) In scenarios where a large number of messages are pushed and data is uploaded, WebSocket traffic consumption is relatively large. Although the traffic consumption of a long WebSocket connection is smaller than that of a short connection, the tiny additional traffic in scenarios where a large number of messages are pushed and data is uploaded will be amplified, resulting in a relatively large total traffic consumption.

[0005] (2) The cost of replacing the WebSocket protocol with other low-traffic protocols is high. In order to achieve the goal of low traffic, there are two common methods: one is to customize the TCP-based protocol to reduce traffic by only transmitting the data of interest. This method is effective, but it is not very versatile, which makes it difficult to promote and use. In addition, the replacement cost of this method is high. Completely abandoning the WebSocket protocol will also lead to the abandonment of mature implementation methods in the existing WebSocket protocol. The implementation risk of using an immature new protocol for vehicle-side devices and servers is also high. Another method is to replace the WebSocket protocol with the MQTT (Message Queuing Telemetry Transport) transmission protocol based on the message publish / subscribe mode. This method is relatively mature, but it is quite different from WebSocket in code implementation. The MQTT transmission protocol needs to add a message middleware, and the message interaction becomes a publish / subscribe mode. The overall interaction process changes greatly, and the cost of replacement is high. Summary of the invention

[0006] In view of this, an object of the present invention is to provide a long connection method for a vehicle end to alleviate the above-mentioned problems existing in the related art.

[0007] In the first aspect, an embodiment of the present invention provides a long connection method for a vehicle side, which is applied to a device side, and the method includes: establishing a TCP connection with a server side, and sending a login frame containing login information to the server side; wherein the login information has a first preset format and includes a login instruction, the mask bit of the login frame is 0, and the mask key of the login frame is empty; the server side is used to establish a TCP connection with the device side and receive the login frame; if a heartbeat Pong frame sent by the server side is received, the vehicle positioning information of the vehicle corresponding to the device side is obtained, and a positioning frame containing the vehicle positioning information is uploaded to the server side; wherein the vehicle positioning information has a second preset format and includes a positioning instruction, and the mask bit of the positioning frame is 0, the mask key of the positioning frame is empty; the server is also used to determine whether the device has successfully logged in based on the login frame, and send a heartbeat Pong frame to the device when the device has successfully logged in; receive a reminder message pushed by the server indicating that the vehicle corresponding to the device is close to the site; the server is also used to call back the vehicle positioning information contained in the positioning frame to the business system when receiving the positioning frame, and push a reminder message to the device when receiving the first notification sent by the business system; the business system is used to store the vehicle positioning information, and determine whether the vehicle corresponding to the device is close to the site based on the vehicle positioning information and the pre-stored site positioning information, and send a first notification to the server when the vehicle corresponding to the device is close to the site.

[0008] In a second aspect, an embodiment of the present invention further provides a long connection method for a vehicle end, the method being applied to a server end, the method comprising: establishing a TCP connection with a device end, and receiving a login frame containing login information sent by the device end; wherein the login information has a first preset format and includes a login instruction, the mask bit of the login frame is 0, and the mask key of the login frame is empty; the device end is used to establish a TCP connection with the server end, and send a login frame to the server end; based on the login frame, determining whether the login of the device end is successful, and if the login of the device end is successful, sending a heartbeat Pong frame to the device end; if a positioning frame uploaded by the device end is received, calling back the vehicle positioning information contained in the positioning frame to the business system; Among them, the positioning frame includes the vehicle positioning information of the vehicle corresponding to the device end, the vehicle positioning information has a second preset format and includes a positioning instruction, the mask bit of the positioning frame is 0, and the mask key of the positioning frame is empty; the device end is also used to obtain the vehicle positioning information of the vehicle corresponding to the device end when receiving the heartbeat Pong frame, and upload the positioning frame to the server end; the business system is used to store the vehicle positioning information, and judge whether the vehicle corresponding to the device end is close to the site based on the vehicle positioning information and the pre-stored site positioning information; if the first notification sent by the business system is received, a reminder message is pushed to the device end; the business system is also used to send a first notification to the server end when the vehicle corresponding to the device end is close to the site.

[0009] An embodiment of the present invention provides a long connection method for a vehicle side, which establishes a TCP connection between a device side and a server side, wherein the device side sends a login frame containing login information to the server side, the server side determines whether the device side has successfully logged in based on the login frame and sends a heartbeat Pong frame to the device side when the device side has successfully logged in, when the device side receives the heartbeat Pong frame, the device side obtains the vehicle positioning information of the vehicle corresponding to the device side and uploads a positioning frame containing the vehicle positioning information to the server side, the server side calls back the vehicle positioning information contained in the positioning frame to the business system, the business system stores the vehicle positioning information and determines whether the vehicle corresponding to the device side is close to the site based on the vehicle positioning information and pre-stored site positioning information, and sends a first notification to the server side when the vehicle corresponding to the device side is close to the site, and when the server side receives the first notification, it pushes a reminder message to the device side indicating that the vehicle corresponding to the device side is close to the site. By adopting the above technology, when establishing a connection between the device and the server, the device only needs to send a login frame to the server to perform login verification and thus realize one-stage login. Compared with the existing WebSocket long connection technology that still requires http handshake, it can reduce the traffic when establishing a long connection, and the syntax reuse of the heartbeat Pong frame makes the connection method between the device and the server compatible with the implementation method in the existing WebSocket protocol, reducing the modification cost of the WebSocket protocol; the device uploads the vehicle positioning information to the server through a long connection so that the server can directly call back the vehicle positioning information to the business system to determine whether the vehicle is close to the station, which can facilitate the business system to notify the server when the vehicle is close to the station and trigger the server to push a reminder message to the device, thereby reducing the traffic of the vehicle-side device during message push and data upload on the basis of realizing the reminder boarding and alighting function; since the format of the information contained in the data frame sent by the device to the server can be preset, the flexibility of the vehicle-side device in information interaction can be improved by presetting the information format, thereby meeting the information interaction needs of different scenarios.

[0010] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention are realized and obtained by the structures particularly pointed out in the description, claims and drawings.

[0011] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0013] Figure 1 It is a flow chart of a long connection method for a vehicle end in an embodiment of the present invention;

[0014] Figure 2 It is a flow chart of another long connection method for a vehicle end in an embodiment of the present invention;

[0015] Figure 3 This is a main flow diagram of a long connection method for a vehicle end in an embodiment of the present invention;

[0016] Figure 4 This is a partial flow chart of a long connection method for a vehicle end in an embodiment of the present invention;

[0017] Figure 5 This is a partial flow chart of another long connection method for a vehicle end in an embodiment of the present invention;

[0018] Figure 6 A schematic diagram of an interaction scenario in an embodiment of the present invention;

[0019] Figure 7 The figure is a schematic diagram of the structure of a long connection management system in an embodiment of the present invention. DETAILED DESCRIPTION

[0020] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution of the present invention will be clearly and completely described in combination with the embodiments below. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0021] Currently, there are two main problems with the existing WebSocket long connection method for vehicle-side devices: (1) In scenarios with large amounts of message push and data upload, WebSocket traffic consumption is relatively high; (2) The cost of replacing the WebSocket protocol with other low-traffic protocols is high.

[0022] Based on this, the present invention provides a long connection method for the vehicle end, which can alleviate the above-mentioned problems existing in the related technology.

[0023] In order to facilitate those skilled in the art to better understand the present invention, the technical terms involved in the present invention are briefly introduced below.

[0024] Long Connection: refers to the fact that multiple data packets can be sent continuously on a connection. During the connection, if no data packet is sent, both parties need to send link detection packets.

[0025] WebSocket: A protocol for full-duplex communication over a single TCP connection, allowing the server to actively push data to the device.

[0026] Frame: The present invention specifically refers to the Frame of WebSocket, which is the data transmission unit of WebSocket and is divided into text frame, binary frame, Close frame, Ping frame, Pong frame, etc. The present invention uses the same frame structure.

[0027] Reserved bit (RSV): In the present invention, it specifically refers to the field in the WebSocket frame, which is divided into RSV1, RSV2, and RSV3, each occupying 1 bit. In the present invention, RSV1 is used to indicate whether data compression is performed, RSV3 is used to indicate whether the device needs to confirm the message receipt to the server, and RSV2 is used to indicate whether data encryption is performed.

[0028] Mask bit (MASK): in the present invention, specifically refers to a field in a WebSocket frame, which occupies 1 bit and is used to identify whether a mask key is generated.

[0029] Masking-key: In the present invention, it specifically refers to a field in the WebSocket frame, which occupies 32 bits and exists in the frame sent from the device to the server. It is used to combat cache poisoning attacks commonly seen in the http protocol.

[0030] The embodiment of the present invention provides a long connection method for a vehicle end, which can be applied to a device end, see Figure 1 As shown, the method may include the following steps:

[0031] Step S102, establishing a TCP connection with the server, and sending a login frame containing login information to the server.

[0032] The login information has a first preset format and includes a login instruction, the mask bit of the login frame is 0, and the mask key of the login frame is empty. The server can be used to establish a TCP connection with the device and receive the login frame.

[0033] Step S104, if the heartbeat Pong frame sent by the server is received, the vehicle positioning information of the vehicle corresponding to the device is obtained, and a positioning frame containing the vehicle positioning information is uploaded to the server.

[0034] The vehicle positioning information has a second preset format and includes a positioning instruction, the mask bit of the positioning frame is 0, and the mask key of the positioning frame is empty. The server can also be used to determine whether the device has successfully logged in based on the login frame, and send a heartbeat Pong frame to the device when the device has successfully logged in.

[0035] Taking the establishment of a long connection between the device and the service side during vehicle driving as an example, the driver turns on the vehicle-side device, and the device enters the connection establishment phase. Due to the high-speed movement of the vehicle, the base stations providing network services are constantly switched, and the gathering of people causes people's mobile phones and other devices to gather together to compete for network resources, so network instability often occurs. In the case of unstable network, long connections are often interrupted, and the device side often needs to re-establish the connection. The traffic consumption for establishing the connection cannot be ignored.

[0036] The existing WebSocket long connection method adopts a two-stage login, the first stage is the http handshake, and the second stage is TCP transmission. The first stage confirms whether the handshake is successful through the http request and response, and the second stage performs business login verification through the business response data in the frame to confirm whether the login is successful. In order to reduce the traffic consumption when the vehicle-side device establishes a connection, a TCP connection can be directly established between the device and the server, and the device sends a binary frame containing login information to the server. After the server verifies the login information successfully, it returns a Pong frame to the device, which represents the successful login of the device. The operation method of the device directly connecting to the server through TCP and sending a binary frame containing login information to the server eliminates the traffic consumption of the http handshake in the first stage compared with the existing WebSocket long connection method; the operation method of returning the Pong frame after the server verifies the login information successfully, because the Pong frame that conforms to the WebSocket syntax is used to express the general login result semantics, compared with the existing WebSocket long connection method, the traffic consumption of the business response data in the frame is eliminated, and the reuse of the Pong frame is compatible with some existing implementation methods of the WebSocket protocol. Only the frame recognition method of the login result needs to be adjusted to achieve login verification, which reduces the cost of replacing the WebSocket protocol.

[0037] In the existing WebSocket long connection mode, the frames uploaded by the device to the server are generally in json format (that is, they need to contain paired field names and field values), and the frames uploaded by the device to the server usually need to contain a 32-bit mask key to combat cache poisoning attacks commonly seen in the http protocol. The device directly connects to the server through TCP and sends a binary frame containing login information to the server. Since there is no need for an http handshake, there is no need for a mask key in terms of security. Compared with the existing WebSocket long connection mode, the traffic consumption of the mask key is eliminated, and the reuse of frame syntax can be directly compatible with some existing implementations of the WebSocket protocol, thereby reducing the cost of replacing the WebSocket protocol.

[0038] Step S106, receiving a reminder message pushed by the server indicating that the vehicle corresponding to the device is approaching a station.

[0039] The server can also be used to call back the vehicle positioning information contained in the positioning frame to the business system when receiving the positioning frame, and push a reminder message to the device when receiving the first notification sent by the business system. The business system can be used to store the vehicle positioning information, and determine whether the vehicle corresponding to the device is close to the site based on the vehicle positioning information and the pre-stored site positioning information. The business system can also be used to send a first notification to the server when the vehicle corresponding to the device is close to the site.

[0040] Continuing with the previous example, during the driving process of the vehicle, the device side continuously uploads the vehicle GPS data of the vehicle it is in to the server side in the form of positioning frames. The server side transmits the uploaded vehicle GPS data to the business system. The business system saves the vehicle GPS data and compares it with the pre-stored site GPS data to determine whether the vehicle is close to the site. When the vehicle is close to the site, the business system will notify the server side. After receiving the notification, the server side pushes a boarding and alighting reminder message to the device side. After receiving the boarding and alighting reminder message, the device side broadcasts a voice message to remind passengers to board and alight.

[0041] The embodiment of the present invention provides a long connection method for a vehicle side. When establishing a connection between a device side and a server side, the device side only needs to send a login frame to the server side to perform login verification and thus realize one-stage login. Compared with the existing WebSocket long connection technology which still needs to perform an http handshake, the traffic when establishing a long connection can be reduced, and the syntax reuse of the heartbeat Pong frame makes the connection method between the device side and the server side compatible with the implementation method in the existing WebSocket protocol, thereby reducing the modification cost of the WebSocket protocol; the device side uploads the vehicle positioning information to the server side through the long connection so that the server side directly calls back the vehicle positioning information to the business system to determine whether the vehicle is close to the station, which can facilitate the business system to notify the server side when the vehicle is close to the station and then trigger the server side to push a reminder message to the device side, thereby reducing the traffic of the vehicle-side device during message push and data upload on the basis of realizing the reminder boarding and alighting function; since the format of the information contained in the data frame sent by the device side to the server side can be preset, the flexibility of the vehicle-side device in information interaction can be improved by presetting the information format, thereby meeting the information interaction requirements of different scenarios.

[0042] As a possible implementation method, the above-mentioned long connection method for the vehicle side may also include: if the time interval between the current moment and the moment of the last data interaction with the server side exceeds a preset time interval threshold, a heartbeat Ping frame is sent to the server side to maintain the TCP connection with the server side.

[0043] The server can also be used to send a heartbeat Pong frame to the device when the time interval between the current moment and the last moment of data interaction with the device exceeds a preset time interval threshold, so as to maintain the TCP connection with the device.

[0044] Continuing with the previous example, if the server verifies the login information successfully, the server sends a Pong frame to the device to represent that the device has successfully logged in, and starts the timed heartbeat mechanism; the timed heartbeat mechanism is specifically as follows: a first duration is preset for each interval, the server calculates the time interval between the current moment and the last time data was sent to the device and determines whether the time interval exceeds the preset time interval threshold. If so (i.e., the time interval exceeds the preset time interval threshold), a Pong frame is sent to the device to maintain a TCP connection with the device. If the device receives a Pong frame representing a successful login, the device starts the timed heartbeat mechanism, and the timed heartbeat mechanism is specifically as follows: a second duration is preset for each interval, the device calculates the time interval between the current moment and the last time data was sent to the server and determines whether the time interval exceeds the preset time interval threshold. If so (i.e., the time interval exceeds the preset time interval threshold), a Ping frame is sent to the server to maintain a TCP connection with the server.

[0045] As a possible implementation, after establishing a TCP connection with the server in the above step S102, the above long connection method for the vehicle side may further include: receiving passenger payment information pushed by the server.

[0046] The server can also be used to push the passenger payment information to the device when receiving the second notification sent by the business system. The business system can be used to send the second notification to the server when the passenger payment is successful.

[0047] Continuing with the previous example, there is a QR code in the vehicle for passengers to scan and pay. Passengers can use their mobile phones to scan the QR code to pay for the fare; the driver turns on the vehicle-side device and establishes a connection between the device and the server. After the passenger scans and pays successfully, the business system notifies the server of the payment success. After receiving the notification, the server pushes the payment information including the seat number to the device, so that the driver can confirm on the device whether the actual seat is paid based on the payment information pushed by the server.

[0048] As a possible implementation method, the above-mentioned long connection method for the vehicle side may also include: receiving vehicle positioning information pushed by the server side.

[0049] The server can also be used to call the vehicle positioning information stored in the business system and push it to the device when receiving the third notification sent by the business system; the business system can be used to send the third notification to the server according to a preset time step.

[0050] Continuing with the previous example, in a scenario where a fleet consists of multiple vehicles, the business system notifies the server to push the vehicle GPS data at every preset third time interval. After receiving the notification, the server retrieves the vehicle GPS data of all vehicles in the fleet from the business system and pushes it to the device connected to the server, so that the driver can change shifts in time and flexibly adjust the vehicle route according to the location of all vehicles in the fleet on the device side.

[0051] As a possible implementation method, the above-mentioned long connection method for the vehicle side may also include: if a Close frame sent by the server side is received, disconnecting the TCP connection with the server side.

[0052] The server can be used to send a Close frame to the device when the device login fails and disconnect the TCP connection with the device.

[0053] Continuing with the previous example, if the server fails to verify the login information, the server sends a Close frame to the device to indicate that the device login failed, and disconnects the TCP connection with the device. After the device receives the Close frame indicating the login failure, it disconnects the TCP connection with the server.

[0054] The embodiment of the present invention also provides another long connection method for the vehicle side, which can be applied to the server side, see Figure 2 As shown, the method may include the following steps:

[0055] Step S202, establish a TCP connection with the device end, and receive a login frame containing login information sent by the device end.

[0056] The login information has a first preset format and includes a login instruction, the mask bit of the login frame is 0, and the mask key of the login frame is empty. The device can be used to establish a TCP connection with the server and send a login frame to the server.

[0057] Step S204, judging whether the device has successfully logged in based on the login frame, if the device has successfully logged in, sending a heartbeat Pong frame to the device.

[0058] Step S206: If the positioning frame uploaded by the device is received, the vehicle positioning information contained in the positioning frame is called back to the business system.

[0059] The positioning frame includes the vehicle positioning information of the vehicle corresponding to the device end, the vehicle positioning information has a second preset format and includes a positioning instruction, the mask bit of the positioning frame is 0, and the mask key of the positioning frame is empty. The device end can also be used to obtain the vehicle positioning information of the vehicle corresponding to the device end when receiving the heartbeat Pong frame, and upload the positioning frame to the service end. The business system can be used to store the vehicle positioning information, and determine whether the vehicle corresponding to the device end is close to the site based on the vehicle positioning information and the pre-stored site positioning information.

[0060] Step S208: If the first notification sent by the business system is received, a reminder message is pushed to the device.

[0061] The business system can also be used to send a first notification to the service end when the vehicle corresponding to the device end approaches the station.

[0062] As a possible implementation method, the above-mentioned long connection method for the vehicle side may also include: if the time interval between the current moment and the last time of data interaction with the device side exceeds the preset time interval threshold, a heartbeat Pong frame is sent to the device side to maintain the TCP connection with the device side; the device side is also used to send a heartbeat Ping frame to the server side when the time interval between the current moment and the last time of data interaction with the server side exceeds the preset time interval threshold to maintain the TCP connection with the server side.

[0063] As a possible implementation, after establishing a TCP connection with the device side in the above step S202, the above long connection method for the vehicle side may also include: if a second notification sent by the business system is received, pushing the passenger payment information to the device side.

[0064] The device side can also be used to receive the passenger payment information pushed by the device side. The business system can be used to send a second notification to the service side when the passenger payment is successful.

[0065] As a possible implementation method, the above-mentioned long connection method for the vehicle side may also include: if a third notification sent by the business system is received, calling the vehicle positioning information stored in the business system and pushing it to the device side.

[0066] The device side can also be used to receive the vehicle location information pushed by the server side. The business system can be used to send a third notification to the server side according to a preset time step.

[0067] As a possible implementation method, the above-mentioned long connection method for the vehicle side may also include: if the device side login fails, sending a Close frame to the device side and disconnecting the TCP connection with the device side.

[0068] The device can also be used to disconnect the TCP connection with the server when receiving a Close frame sent by the server.

[0069] The implementation principle and technical effects of the long connection method for the vehicle side applied to the server side provided in the embodiment of the present invention are the same as those of the long connection method for the vehicle side applied to the device side. For the sake of brief description, for parts not mentioned in the method embodiment applied to the server side, reference may be made to the corresponding contents in the method embodiment applied to the device side.

[0070] For ease of understanding, the above-mentioned long connection method for the vehicle end is described as follows by taking actual application as an example.

[0071] See also Figure 3 As shown, the main process of the above-mentioned long connection method for the vehicle side may include:

[0072] Step S301, turn on the vehicle-side device and establish a connection.

[0073] When the driver turns on the vehicle-side device, the device will establish a connection with the server.

[0074] When the device establishes a connection with the server, a one-stage login is used, that is, the device first sends a binary frame containing login information to the server, and the server verifies the login information and returns a Pong frame representing success or a Close frame representing failure.

[0075] During the entire driving process, the device and the server adopt a dynamic heartbeat mechanism to maintain a two-way connection. The operation of the dynamic heartbeat mechanism may specifically include: the device sends a Ping frame to the server according to the interval time from the current moment to the last data transmission to the server (i.e., uploading data or sending a Ping frame). If there is continuous data uploading (i.e., the interval time from the current moment to the last data transmission to the server does not exceed the preset threshold), it is not necessary to send a Ping frame to the server. If there is no data uploading for a long time (i.e., the interval time from the previous moment to the last data transmission to the server exceeds the preset threshold), it is necessary to send a Ping frame to the server; the server sends a Pong frame to the device according to the interval time from the current moment to the last data transmission to the device (i.e., pushing a message or sending a Pong frame). If there is continuous data transmission (i.e., the interval time from the current moment to the last data transmission to the device does not exceed the preset threshold), it is not necessary to send a Pong frame to the device. If there is no data transmission for a long time (i.e., the interval time from the current moment to the last data transmission to the device exceeds the preset threshold), it is necessary to send a Pong frame to the device.

[0076] In scenarios with high-frequency data uploads (such as uploading GPS data on the device side), the dynamic heartbeat mechanism saves the traffic consumption of Ping frames; in scenarios with high-frequency message pushes, the dynamic heartbeat mechanism saves the traffic consumption of Pong frames; when the existing WebSocket protocol is replaced or modified with other protocols, it only needs to add a judgment on whether to send a heartbeat. The heartbeat frame does not need to be changed due to syntax reuse, making the cost of replacing or modifying the WebSocket protocol very low.

[0077] Step S302: After the passenger scans the QR code to pay, the seat payment information is pushed to the device, and the driver confirms whether the actual seat is paid.

[0078] After the passenger scans the code to pay, the business system notifies the server that the payment is successful. The server then pushes the payment information including the seat number selected by the passenger to the device, and the driver confirms whether the actual seat is paid.

[0079] When the server pushes information to the device, it uses data compression and comma-separated custom instructions, and uses the reserved bits of the data frame to inform the device whether it needs to confirm that the information has been received and whether the information needs to be encrypted. Specifically, the server first converts the pushed information content into the format of "server business instructions, application identifier, business content" separated by English commas. The specific business content and server business instructions are agreed upon in advance by the business; then the server sets the reserved bit RSV3 to inform the device whether the device needs to confirm that the information has been received. RSV3 is 0, which means that the device does not need to confirm that the information has been received. RSV3 is 1, which means that the device needs to reply to the server to confirm that the information has been received; the server sets the reserved bit RSV2 to inform the device whether the data has been AES encrypted. RSV2 is 1, which means that the data has been AES encrypted. RSV2 is 0, which means that the data has not been AES encrypted; finally, the server sets the reserved bit RSV1 to inform the device whether the data has been compressed. RSV1 is 1, which means compressed, and RSV1 is 0, which means uncompressed; finally, the server transmits the information to the device.

[0080] Since the format of "server business instructions, application identifier, business content" removes the "field name" and uses agreed business instructions, it saves the traffic consumption of the "field name" compared to the json format used by the existing WebSocket protocol; when the existing WebSocket protocol is replaced or transformed into other protocols, only the agreed instructions for commonly used messages can be used, while uncommon messages can remain unchanged. Since the frame syntax remains unchanged, the compatibility cost becomes very low.

[0081] In addition, the reserved bit RSV3 is set to inform the device whether it needs to confirm the receipt of the information, which saves the traffic consumption of the needAck field in the business data; the reserved bit RSV2 is set to inform the device whether the data is AES encrypted, so that the business can be dynamically encrypted according to the information security level, which improves the transmission efficiency, saves the traffic consumption caused by encryption, and ensures the security of the data; the reserved bit RSV1 is set to inform the device whether the data is compressed, which can reduce the data traffic. Therefore, by adopting the operation method of setting the reserved bit, when the existing WebSocket protocol is replaced or transformed into other protocols, it only needs to change the corresponding processing to use the reserved bit to judge, and the reuse of the frame syntax makes the relevant code directly compatible with the relevant implementation of the existing WebSocket protocol without modification.

[0082] Step S303: After the vehicle starts, the device continuously uploads GPS data.

[0083] After the vehicle sets off, the device starts uploading the vehicle's GPS data, and uploads the vehicle's GPS data to the server through a long connection every few seconds; after receiving the GPS data, the server transmits the GPS data to the business system.

[0084] When the device uploads data to the server, it uses data compression and comma-separated custom instructions, and uses the reserved bits of the data frame to inform whether data encryption is required. Specifically, the device first converts the pushed information content into the format of "device-side business instructions, application identification, business content" separated by English commas. The specific business content and device-side business instructions are agreed upon in advance by the business; then the device sets the reserved bit RSV2 to inform the server whether the data is AES encrypted. RSV2 is 1, which means that the data is AES encrypted, and RSV2 is 0, which means that the data is not AES encrypted; then the device sets the reserved bit RSV1 to inform the server whether the data is compressed. RSV1 is 1, which means compressed, and RSV1 is 0, which means uncompressed; finally, the device sets the mask bit MASK to 0 (representing no mask), and accordingly sets the masking key masking-key to empty, and then transmits the data to the server.

[0085] Step S304: the server pushes vehicle GPS data and boarding and alighting reminder messages.

[0086] The business system notifies the server to push vehicle GPS data at regular intervals. The server pushes the GPS data of all vehicles in the fleet to the device. Drivers can learn the location of all vehicles in the fleet through the device and change shifts and flexibly adjust vehicle routes accordingly. When approaching a station, the business system will notify the server. After receiving the notification, the server will push a boarding and alighting reminder message to the corresponding device. After receiving the boarding and alighting reminder message, the device will play a voice to implement the boarding and alighting reminder.

[0087] The above-mentioned long connection method for the vehicle side brings the following beneficial effects: First, the driver turns on the vehicle side device, and the device side enters the connection establishment phase. The device side uses a one-stage login to establish a connection with the server side, which can reduce the traffic consumption when establishing a connection compared to the two-stage login used in the existing WebSocket long connection method. Then, after the passenger scans the code to pay, the business system notifies the server side, and the server side pushes a message to the device side. The driver confirms whether the actual seat has been paid. When the server side pushes the message to the device side, it uses message compression, comma-separated custom instructions, and uses reserved bits to inform the device side whether the device side needs to confirm the receipt of the message and whether the data is encrypted. Compared with the json format and business data content used by the existing WebSocket protocol, it saves traffic consumption. After the vehicle sets off, the device side continuously uploads the GPS data of the vehicle through a long connection. After receiving the notification from the business system, the server side pushes the GPS data of all vehicles in the fleet to the device side, which is convenient for the driver to change shifts and adjust the vehicle route. When the business system finds that the vehicle is close to the station based on the GPS data uploaded by the device side to the server side, it will also notify the server side so that the server side can push the message of getting on and off reminder to the device side. When the device side uploads data to the server side, it uses data compression, comma-separated custom instructions, and uses reserved bits to inform the server side whether the data is encrypted. It also removes the mask key, which can save traffic consumption compared to the existing WebSocket protocol using json format and mask keys. During the entire driving process, the device side and the server side use a dynamic heartbeat mechanism to maintain a two-way connection, which can save the extra traffic generated by reconnection when the network is unstable.

[0088] Therefore, by adopting the above-mentioned long connection method for the vehicle side, when pushing messages and uploading data, the traffic is reduced while ensuring data security and improving transmission efficiency. It can also save the cost of replacing or modifying the existing WebSocket protocol and meet the low traffic requirements when pushing and uploading large amounts of data on the vehicle side.

[0089] See also Figure 4 As shown, in the above-mentioned long connection method for the vehicle side, the process of establishing a connection between the device side and the server side and uploading data to the server side may include:

[0090] Step S401, the device initiates a TCP connection to the server, and after the connection is established, the device sends a login frame.

[0091] After the driver turns on the vehicle-side device, the device initiates a TCP connection to the server. After the connection is successful, the device enters the login phase and sends a login frame containing login information to the server.

[0092] The login information includes a login instruction. For example, the login instruction can be uniformly agreed upon as C001, and the login information format can be "C001, login name, device information"; then the device sets the reserved bit RSV1 of the login frame to 1 (indicating that the login information needs to be compressed), and compresses the login information; then the device sets the mask bit of the login frame to 0, and sets the mask key of the login frame to empty; finally, the device sends the login frame containing the compressed login information to the server.

[0093] Step S402: The server checks whether the login is successful.

[0094] Continuing with the previous example, after the server receives the login frame containing the login information, it first decompresses the data to obtain the login information, then performs login verification according to the instruction C001 contained in the login information, and finally verifies the login name. If the server does not receive the login frame or the time between the time of receiving the login frame and the time of establishing the connection with the device exceeds the preset time threshold, the server determines that the device login has failed.

[0095] Step S403: the server sends a Close frame.

[0096] If the server fails to verify the device login, it sends a Close frame to the device and closes the connection with the device.

[0097] Step S404: The server sends a Pong frame to start the heartbeat.

[0098] The server verifies that the device has successfully logged in, then sends a Pong frame to the device (indicating that the device has successfully logged in), and starts a timed heartbeat. During the timed heartbeat, if the interval between the current time and the last time the server transmitted data to the device exceeds the preset threshold, the server sends a Pong frame to the device to maintain the connection with the device.

[0099] Step S405: The device receives the Pong frame, starts the heartbeat, and starts uploading GPS data.

[0100] The device receives the Pong frame (indicating successful login), starts the scheduled heartbeat, and then starts the scheduled task of uploading the vehicle GPS data to the server. During the scheduled heartbeat process, if the interval between the current time and the last time the device transmitted data to the server exceeds the preset threshold, the device sends a Ping frame to the server to maintain the connection with the server.

[0101] Step S406, the device sets the reserved bit, encrypts and compresses the GPS data, sets the mask key to empty, and then uploads the GPS data frame.

[0102] For example, it can be agreed that the GPS data upload instruction contained in the GPS data is C002, and the GPS data format can be "C002, GPS latitude and longitude"; then the device side sets the reserved bit RSV2 of the GPS data frame to 1 (indicating that the GPS data needs to be encrypted by AES data) according to the message security level and performs AES data encryption on the GPS data, sets the reserved bit RSV1 of the GPS data frame to 1 (indicating that the GPS data needs to be compressed) and performs data compression on the GPS data; then the device side sets the mask bit of the GPS data frame to 0, and sets the mask key of the GPS data frame to empty; finally, the device side uploads the GPS data frame containing the GPS data to the server.

[0103] Step S407, the server receives the GPS data frame, parses the reserved bits, decompresses, decrypts, and calls back the service system.

[0104] Continuing with the previous example, the server receives the GPS data frame uploaded by the device, first parses the reserved bit, decompresses it according to RSV1, decrypts it according to RSV2, and then, based on instruction C002, determines that a business callback is required, and calls the callback address of the business system to perform GPS data transmission between the device and the server.

[0105] See also Figure 5 As shown, the process of pushing a message from the server to the device in the above-mentioned long connection method for the vehicle side may include:

[0106] Step S501: The server receives a push request from the business system, sets a reserved bit, encrypts, compresses data, and pushes information.

[0107] The information pushed by the server to the device may include payment information, boarding and alighting reminder messages, vehicle GPS data, etc., without limitation.

[0108] Taking payment information push as an example, after the server receives the payment information push request from the business system, it can be agreed that the instruction contained in the payment information is S001, which represents the payment information of the seat selected by the passenger, and the format of the payment information can be "S001, message content"; then the server sets the reserved bit RSV2 of the payment information to 1 according to the security level of the payment information (indicating that the payment information needs to be encrypted with AES data) and performs AES data encryption on the payment information, sets the reserved bit RSV1 of the payment information to 1 (indicating that the payment information needs to be compressed) and performs data compression on the payment information; then the server sets the reserved bit RSV3 of the payment information to 1 according to the importance of the payment information (indicating that the device needs to confirm that the payment information has been received); finally, the server pushes the payment information to the device.

[0109] Step S502: The device receives the information, parses the reserved bits, decompresses and decrypts them.

[0110] Taking payment information push as an example, after the device receives the payment information, it first parses to obtain the reserved bits RSV1, RSV2, and RSV3, then decompresses the payment information according to RSV1, and decrypts the payment information according to RSV2.

[0111] Step S503, the device sets the reserved bit, encrypts and compresses the data, sets the mask key to empty, and uploads the information confirmation message.

[0112] Taking payment information push as an example, the device determines whether to upload a confirmation message indicating that the payment information has been received to the server based on the reserved bit RSV3 of the payment information. It can be agreed that the confirmation instruction contained in the confirmation message is C003, and the data format of the confirmation message can be "C003, the timestamp of the device receiving the payment information"; then the device sets the reserved bit RSV2 of the confirmation message to 1 (indicating that the confirmation message needs to be encrypted with AES data) according to the security level of the confirmation message and performs AES data encryption on the confirmation message, sets the reserved bit RSV1 of the confirmation message to 1 (indicating that the confirmation message needs to be compressed) and performs data compression on the confirmation message; then the device sets the mask bit of the confirmation message to 0, and sets the mask key of the confirmation message to empty; finally, the device uploads the confirmation message to the server and processes the payment information. When receiving the payment information, the device will also play a voice prompt indicating that the seat selected by the passenger has been paid.

[0113] Similar to payment information push, in the scenario of boarding and alighting reminder message push, the device will also play voice to remind passengers to board and alight when receiving the boarding and alighting reminder message.

[0114] Step S504, the server receives the information confirmation message, parses the reserved bits, decompresses, decrypts, and processes the information confirmation message.

[0115] Continuing with the previous example, the server receives the confirmation message, parses the reserved bits RSV1 and RSV2 of the confirmation message, decompresses the confirmation message according to RSV1, performs AES decryption on the confirmation message according to RSV2, and then performs corresponding processing according to instruction C003 to update the push information in the database to a confirmed status.

[0116] For ease of understanding, the above-mentioned long connection method for the vehicle side is exemplarily described as follows using a specific interaction scenario as an example.

[0117] See also Figure 6As shown in the figure, the application administrator creates a new application in the persistent connection management system. After the device installs the corresponding application, the application automatically registers the vehicle-side device to the persistent connection management system. When the vehicle enters the operation time, the driver turns on the vehicle-side device, and the device initiates a connection to the persistent connection service on the server side and sends the login information. The persistent connection service performs login verification by calling the persistent connection management system, and the login is completed. Then, the vehicle sets off, and the device starts to upload GPS data to the persistent connection service at a regular interval. The persistent connection service parses and forwards the GPS data to the persistent connection management system, and the persistent connection management system completes the business processing according to the instructions in the GPS data, that is, the persistent connection management system calls the GPS data back to the business system for processing, and the business system can save the vehicle location information. The business system uses GPS data to check whether the vehicle is close to the station, and when the vehicle is close to the station, it calls the persistent connection management system to initiate the push of the boarding and alighting reminder message. The persistent connection management system then parses and forwards the boarding and alighting reminder message to the persistent connection service. The persistent connection service pushes the boarding and alighting reminder message encapsulated with the instruction (such as "S002, about to arrive at XX station, next station XX") to the vehicle-side device. After receiving the boarding and alighting reminder message, the device plays the boarding and alighting reminder. The persistent connection management system may also store application information, device information, and boarding and alighting reminder messages in a persistent connection management DB (ie, a persistent connection management database).

[0118] Above Figure 6 The long connection method used for the vehicle side in the interactive scenario shown brings the following beneficial effects: First, the business logic and the long connection logic are isolated from each other, and the iterative release of the business system will not affect the long connection management system and the long connection service, saving the corresponding development costs. Secondly, different applications are allowed to be installed on the same device side, and the applications are isolated from each other and do not affect each other's message push and data upload. The device numbers registered for applications on the same device side are the same, and the long connection logic can be further analyzed and optimized by associating different applications according to the device numbers. Thirdly, the long connection service and the long connection management system are isolated from each other, because the long connection service is relatively stable, and the long connection management system will add new business instructions, and the business logic is closed in the long connection management system, reducing the situation where the long connection is interrupted due to the iterative release of the management system. Finally, the long connection management system manages all applications in a unified manner, which is convenient for the long connection of applications to be launched and offline.

[0119] For the long connection method for the vehicle end provided in the above embodiment, the embodiment of the present invention also provides a long connection management system, see Figure 7 As shown, the system may include the following parts:

[0120] The application management module 701 is used to manage the applications provided to the device for installation and configure the callback address of the uploaded data. When the server receives the data uploaded by the device, it will call the callback address to transmit the data to the business system.

[0121] The device management module 702 is used to manage the vehicle-side devices on which the application is installed and push messages to the device side.

[0122] The message management module 703 is used to check the pushed messages, check whether the device has received the message, and re-push the message to the device.

[0123] The above-mentioned long connection management system provided by the embodiment of the present invention can configure different business system callback addresses according to different applications, so that the logic of uploading data and the business logic are isolated from each other and do not affect each other. The application configuration takes effect immediately, which improves the effectiveness while saving development costs and meeting business needs.

[0124] After the vehicle sets off, the device side continuously uploads the vehicle's GPS data through a long connection, and the server side pushes the vehicle's GPS to other vehicle-side devices in the fleet to facilitate shift changes and route adjustments; based on the uploaded GPS data, when the business system finds that the vehicle is approaching a station, it will also notify the long connection server, and the server side will push a message to remind the device side to get on and off the vehicle; when the device side uploads data to the server side, it uses data compression, comma-separated custom instructions, uses reserved bits to inform whether the data is encrypted, and removes the mask key. During the entire driving process, the device side and the server side use dynamic heartbeats to maintain a two-way connection.

[0125] Unless otherwise specifically stated, the relative steps, numerical expressions and values ​​of the components and steps set forth in these embodiments do not limit the scope of the present invention.

[0126] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0127] In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.

[0128] Finally, it should be noted that the above-described embodiments are only specific implementations of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The protection scope of the present invention is not limited thereto. Although the present invention is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed by the present invention, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims

1. A long connection method for vehicle end, characterized in that: The method is applied to a device, and includes: Establishing a TCP connection with the server, and sending a login frame containing login information to the server; wherein the login information has a first preset format and includes a login instruction, the mask bit of the login frame is 0, and the mask key of the login frame is empty; the server is used to establish a TCP connection with the device and receive the login frame; If a heartbeat Pong frame sent by the server is received, the vehicle positioning information of the vehicle corresponding to the device is obtained, and a positioning frame containing the vehicle positioning information is uploaded to the server; wherein the vehicle positioning information has a second preset format and includes a positioning instruction, the mask bit of the positioning frame is 0, and the mask key of the positioning frame is empty; the server is also used to determine whether the device has successfully logged in based on the login frame, and send a heartbeat Pong frame to the device when the device has successfully logged in; Receive a reminder message pushed by the server indicating that the vehicle corresponding to the device is close to a site; the server is also used to call back the vehicle positioning information contained in the positioning frame to the business system when receiving the positioning frame, and push a reminder message to the device when receiving the first notification sent by the business system; the business system is used to store the vehicle positioning information, and determine whether the vehicle corresponding to the device is close to the site based on the vehicle positioning information and pre-stored site positioning information; the business system is also used to send a first notification to the server when the vehicle corresponding to the device is close to the site.

2. The method according to claim 1, characterized in that The method further comprises: If the time interval between the current moment and the last time data interaction with the server exceeds the preset time interval threshold, a heartbeat Ping frame is sent to the server to maintain the TCP connection with the server; the server is also used to send a heartbeat Pong frame to the device to maintain the TCP connection with the device when the time interval between the current moment and the last time data interaction with the device exceeds the preset time interval threshold.

3. The method according to claim 1, characterized in that After establishing a TCP connection with the server, the method further includes: Receive the passenger payment information pushed by the server; the server is also used to push the passenger payment information to the device when receiving the second notification sent by the business system; the business system is used to send the second notification to the server when the passenger payment is successful.

4. The method according to claim 1, characterized in that: The method further comprises: Receive the vehicle positioning information pushed by the server; the server is also used to call the vehicle positioning information stored in the business system and push it to the device when receiving the third notification sent by the business system; the business system is used to send the third notification to the server according to a preset time step.

5. The method according to claim 1, characterized in that The method further comprises: If a Close frame is received from the server, the TCP connection with the server is disconnected; the server is used to send a Close frame to the device when the device fails to log in, and disconnect the TCP connection with the device.

6. A long connection method for vehicle end, characterized in that: The method is applied to the server, and the method includes: Establishing a TCP connection with the device end, and receiving a login frame containing login information sent by the device end; wherein the login information has a first preset format and includes a login instruction, the mask bit of the login frame is 0, and the mask key of the login frame is empty; the device end is used to establish a TCP connection with the server end, and send a login frame to the server end; Determine whether the device has logged in successfully based on the login frame, and if the device has logged in successfully, send a heartbeat Pong frame to the device; If the positioning frame uploaded by the device end is received, the vehicle positioning information contained in the positioning frame is called back to the business system; wherein the positioning frame contains the vehicle positioning information of the vehicle corresponding to the device end, the vehicle positioning information has a second preset format and includes a positioning instruction, the mask bit of the positioning frame is 0, and the mask key of the positioning frame is empty; the device end is also used to obtain the vehicle positioning information of the vehicle corresponding to the device end when receiving a heartbeat Pong frame, and upload the positioning frame to the service end; the business system is used to store the vehicle positioning information, and determine whether the vehicle corresponding to the device end is close to the site based on the vehicle positioning information and the pre-stored site positioning information; If the first notification sent by the business system is received, a reminder message is pushed to the device end; the business system is also used to send a first notification to the service end when the vehicle corresponding to the device end is approaching a station.

7. The method according to claim 6, characterized in that The method further comprises: If the time interval between the current moment and the last time data interaction with the device end exceeds the preset time interval threshold, a heartbeat Pong frame is sent to the device end to maintain the TCP connection with the device end; the device end is also used to send a heartbeat Ping frame to the server end when the time interval between the current moment and the last time data interaction with the server end exceeds the preset time interval threshold to maintain the TCP connection with the server end.

8. The method according to claim 6, characterized in that After establishing a TCP connection with the device, the method further includes: If the second notification sent by the business system is received, the passenger payment information is pushed to the device end; the device end is also used to receive the passenger payment information pushed by the device end; the business system is used to send a second notification to the server end when the passenger payment is successful.

9. The method according to claim 6, characterized in that The method further comprises: If a third notification sent by the business system is received, the vehicle positioning information stored in the business system is called and pushed to the device end; the device end is also used to receive the vehicle positioning information pushed by the server end; the business system is used to send a third notification to the server end according to a preset time step.

10. The method according to claim 6, characterized in that The method further comprises: If the device fails to log in, a Close frame is sent to the device and the TCP connection with the device is disconnected; the device is also used to disconnect the TCP connection with the server when receiving the Close frame sent by the server.