Method, device, system, detection equipment, client and medium for resuming transmission after network disconnection
By establishing the correspondence between event type and subscription identity in the security system, the problem of event relay after client communication is interrupted is solved, the accurate event relay and storage space are achieved, and the reliability and efficiency of the system are improved.
Patent Information
- Application Number
- CN202411146916.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-20
- Publication Date
- 2024-12-03
- Estimated Expiration
- 2044-08-20
AI Technical Summary
In the security system, the detection device cannot accurately identify the client and continue the event after the client communication is interrupted, resulting in event missed and storage space wasted.
By storing the consistency of subscription identification before and after communication interruption, establishing the correspondence between event type and subscription identification, realizing single storage of event type, and accurately identifying the client and continuing events during interruption during communication recovery.
It ensures that the incidents are discontinued, saves the storage space of the detection equipment, avoids incident omissions, and improves the reliability and efficiency of the system.
Smart Images

Figure CN118694806B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of security technology, and in particular to a method, device, system, detection equipment, client and medium for resuming transmission after network disconnection. Background Art
[0002] With the development of society, public safety issues have received widespread attention from all walks of life, and security systems have become an important measure to ensure public safety. The security system includes multiple detection devices and multiple clients. Each detection device is used to detect the video in the defense area and determine the events that occurred in the defense area. Among them, the detection device can be an image acquisition device. The client can subscribe to different types of events from the detection device, so that after the detection device to which it is connected detects the corresponding type of event, it can report the event to the client.
[0003] Specifically, the client can send a message including the client identifier, IP (Internet Protocol) address, and port information as an identity identifier to the detection device to subscribe to events. When the detection device detects an event subscribed by the client, it identifies the client through the identity identifier and sends the event to the client. In the case where the communication between the client and the detection device is interrupted and then restored, the client can send the identity identifier to the detection device again to inform it that the communication has been restored. The detection device can then send the events subscribed by the client detected during the period of communication interruption to the client.
[0004] However, the client's identity identification may change due to various situations such as client device updates and changes in the client's communication environment. In this case, the detection device cannot accurately identify the client based on the client's identity identification recorded by itself, nor can it continue to transmit the events recorded during the network disconnection to the client. Summary of the invention
[0005] The purpose of the embodiments of the present application is to provide a method, device, system, detection equipment, client and medium for resuming transmission after network disconnection, so as to achieve event network disconnection and resuming transmission. The specific technical solution is as follows:
[0006] In a first aspect, an embodiment of the present application provides a method for resuming transmission after network disconnection, which is applied to a detection device in a security system, wherein the security system further includes at least one client communicating with the detection device; the method includes:
[0007] After detecting a communication interruption with a first client, storing events of an event type subscribed to by the first client detected during the communication interruption, wherein the first client is at least one of the clients;
[0008] Receive a resume request sent by a second client, and determine a target event type corresponding to the target subscription identifier based on a target subscription identifier included in the resume request and a first correspondence between a pre-recorded event type and a subscription identifier, wherein the second client is at least one of the first clients, and the resume request is sent by the second client after communication is restored;
[0009] Sending a target event of the target event type included in the stored events to the second client.
[0010] Optionally, before the step of storing events of an event type subscribed by the first client detected during the communication interruption after detecting the communication interruption with the first client, the method further includes:
[0011] Receive a subscription request sent by each client, wherein the subscription request includes a subscription identifier of the client and an event type of an event to be subscribed, and the subscription identifier is an identifier generated by the client for uniquely identifying the client;
[0012] The event type is associated with the subscription identifier of each client that has subscribed to the event type, so as to obtain a first corresponding relationship between the event type and the subscription identifier of each client.
[0013] Optionally, before the step of receiving the subscription request sent by each client, the method further includes:
[0014] When receiving the subscription identifier range acquisition instruction sent by each client, the range of subscription identifiers supported by the client is sent to the client, so that the client generates a subscription identifier suitable for the detection device within the range.
[0015] Optionally, the detection device supports storing events corresponding to the retransmission paths with a preset number of retransmission paths at the same time, and each client corresponds to one retransmission path;
[0016] After the step of receiving the subscription request sent by each client, the method further includes:
[0017] If the current resuming path reaches the preset number of resuming paths, based on the preset priorities of the clients, determining the client to be cancelled from the clients to which the resuming path has been allocated;
[0018] The retransmission path corresponding to the client to be cancelled is released, and the released retransmission path is allocated to the client that sends the subscription request.
[0019] Optionally, the detection device stores events of each event type non-repetitively;
[0020] The step of storing events of an event type subscribed by the first client detected during the communication interruption after the communication interruption with the first client is detected includes:
[0021] After detecting that communication with a first client is interrupted, for each event of an event type subscribed by the first client detected during the communication interruption, the event is stored only once, wherein the first client includes a plurality of clients;
[0022] The step of sending the target event of the target event type included in the stored events to the second client comprises:
[0023] The target event of the target event type included in each event stored only once is sent to each second client respectively.
[0024] Optionally, each event has an event identifier for uniquely identifying the event;
[0025] Before the step of receiving the resume request sent by the second client, the method further includes:
[0026] Recording a second correspondence between an event identifier of an event of an event type subscribed by the first client detected during the communication interruption and a subscription identifier of the first client;
[0027] The step of sending the target event of the target event type included in the stored events to the second client comprises:
[0028] Sending a target event of the target event type and a target event identifier of the target event included in the stored events to the second client;
[0029] When receiving a receipt message including the target event identifier and the target subscription identifier sent by the second client, the corresponding relationship between the target event identifier and the target subscription identifier in the second corresponding relationship is deleted, and / or the stored target event is deleted.
[0030] Optionally, the method further includes:
[0031] receiving a subscription cancellation request sent by a third client, wherein the subscription cancellation request includes a subscription identifier of the third client, and the third client is at least one of the clients that have subscribed to the event;
[0032] The corresponding relationship between the subscription identifier of the third client and each event type in the recorded first corresponding relationship is deleted, and a cancellation success notification message is sent to the third client.
[0033] Optionally, the subscription identifier has a validity period;
[0034] The step of storing events of the event type subscribed by the first client detected during the communication interruption includes:
[0035] The event of the event type subscribed by the first client, detected by the detection device during the communication interruption and within the validity period of the subscription identifier of the first client, is stored.
[0036] Optionally, the target subscription identifier is the same as the subscription identifier used by the second client when communication is normal, or the target subscription identifier is different from the subscription identifier used by the second client when communication is normal, wherein the subscription identifier used when communication is normal is the subscription identifier used to send subscription events to the second client in real time when communication with the second client is normal.
[0037] In a second aspect, an embodiment of the present application provides a method for resuming transmission after network disconnection, which is applied to a target client in at least one client in a security system, wherein the security system further includes a detection device, and the at least one client communicates with the detection device; the method includes:
[0038] When it is detected that the communication with the detection device is restored, a retransmission request including the target subscription identifier of the target client is sent to the detection device, so that the detection device determines the target event type corresponding to the target subscription identifier based on the target subscription identifier and the first correspondence between the event type and the subscription identifier recorded in advance;
[0039] Receive a target event of the target event type included in the events stored by the detection device itself and sent by the detection device, wherein the target event is an event of the target event type subscribed to by the target client and detected during the communication interruption period stored after the detection device detects that the communication with the target client is interrupted.
[0040] Optionally, before the step of sending a resume request including a target subscription identifier of the target client to the detection device when detecting that the communication with the detection device is restored, the method further includes:
[0041] A subscription request is sent to the detection device, wherein the subscription request includes a target subscription identifier of the target client and an event type of the event to be subscribed, and the target subscription identifier is an identifier generated by the target client for uniquely identifying the target client, so that the detection device receives the subscription request and associates the event type with the target subscription identifier of the target client that has subscribed to the event type, thereby obtaining a first corresponding relationship between the event type and the target subscription identifier of the target client.
[0042] Optionally, before the step of sending a subscription request to the detection device, the method further includes:
[0043] Sending a subscription identification range acquisition instruction to the detection device;
[0044] Receiving a range of subscription identifiers supported by the detection device, wherein the range of subscription identifiers is sent by the detection device when receiving the subscription identifier range acquisition instruction;
[0045] Within the range, a subscription identifier adapted to the detection device is generated.
[0046] Optionally, each event has an event identifier for uniquely identifying the event;
[0047] The step of receiving a target event of the target event type included in the events stored by the detection device itself and sent by the detection device comprises:
[0048] receiving a target event of the target event type and a target event identifier of the target event included in the events stored in the detection device and sent by the detection device;
[0049] A receipt message including the target event identifier and the target subscription identifier is sent to the detection device, so that the detection device stops sending the target event when receiving the receipt message, and deletes the correspondence between the target event identifier and the target subscription identifier in the second correspondence, and / or deletes the stored target event, wherein the second correspondence is the correspondence between the event identifier of the event type subscribed by the target client detected during the communication interruption recorded by the detection device and the target subscription identifier.
[0050] Optionally, the method further includes:
[0051] Sending a subscription cancellation request including the target subscription identifier to the detection device, so that the detection device deletes the correspondence between the target subscription identifier and each event type in the first correspondence recorded;
[0052] Receive a cancellation success notification message sent by the detection device.
[0053] Optionally, the method further includes:
[0054] When there is an event identifier consistent with the target event identifier in the event identifier stored in itself, a repeated event notification message is sent to the detection device so that the detection device receives the repeated event notification message and outputs a retransmission troubleshooting message so that the target object can perform event retransmission troubleshooting.
[0055] In a third aspect, an embodiment of the present application provides a device for resuming transmission after network disconnection, which is applied to a detection device in a security system, wherein the security system further includes at least one client communicating with the detection device; the device includes:
[0056] a storage module, configured to, after detecting a communication interruption with a first client, store events of an event type subscribed to by the first client detected during the communication interruption, wherein the first client is at least one of the clients;
[0057] a resume request receiving module, configured to receive a resume request sent by a second client, and determine a target event type corresponding to the target subscription identifier based on a target subscription identifier included in the resume request and a first correspondence between a pre-recorded event type and a subscription identifier, wherein the second client is at least one of the first clients, and the resume request is sent by the second client after communication is restored;
[0058] An event sending module is used to send a target event of the target event type included in the stored events to the second client.
[0059] In a fourth aspect, an embodiment of the present application provides a device for resuming transmission after network disconnection, which is applied to a target client in at least one client in a security system, wherein the security system further includes a detection device, and the at least one client communicates with the detection device; the device includes:
[0060] a resuming request sending module, configured to send a resuming request including a target subscription identifier of a target client to the detection device when detecting that the communication with the detection device is restored, so that the detection device determines a target event type corresponding to the target subscription identifier based on the target subscription identifier and a first correspondence between the event type and the subscription identifier recorded in advance;
[0061] An event receiving module is used to receive a target event of the target event type included in the event stored by the detection device itself and sent by the detection device, wherein the target event is an event of the target event type subscribed by the target client detected during the communication interruption period stored after the detection device detects that the communication with the target client is interrupted.
[0062] In a fifth aspect, an embodiment of the present application provides a security system, the system comprising a target client and a detection device in at least one client, the at least one client communicating with the detection device;
[0063] The detection device is used to implement any method described in the first aspect;
[0064] The target client is used to implement any method described in the second aspect.
[0065] In a sixth aspect, an embodiment of the present application provides a detection device, including:
[0066] Memory, used to store computer programs;
[0067] The processor is used to implement any method described in the first aspect when executing a program stored in the memory.
[0068] In a seventh aspect, an embodiment of the present application provides a client, including:
[0069] Memory, used to store computer programs;
[0070] The processor is used to implement any method described in the second aspect when executing a program stored in the memory.
[0071] In an eighth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method described in any one of the first aspect or the second aspect is implemented.
[0072] In a ninth aspect, an embodiment of the present application further provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute any of the methods described in the first or second aspect above.
[0073] Beneficial effects of the embodiments of the present application:
[0074] In the solution provided by the embodiment of the present application, the security system may include a detection device and at least one client communicating with the detection device. After detecting that the communication with the first client is interrupted, the detection device may store the event of the event type subscribed by the first client detected during the communication interruption, wherein the first client is at least one of the clients; receive a retransmission request sent by the second client, and determine the target event type corresponding to the target subscription identifier based on the target subscription identifier included in the retransmission request and the first correspondence between the pre-recorded event type and the subscription identifier, wherein the second client is at least one of the first clients, and the retransmission request is sent by the second client after the communication is restored; and then send the target event of the target event type included in the stored event to the second client.
[0075] Since the subscription identifiers sent by each client to the detection device are consistent before and after the communication interruption, and the subscription identifier will not change with the device update of the client, the change of the communication environment of the client, etc., the detection device can accurately identify the client based on the subscription identifiers of each client stored by itself and the subscription identifiers sent by the client after the communication is restored, and retransmit the events recorded during the communication interruption to the client, thereby realizing the retransmission of events about the client after the network is disconnected. In addition, since the first corresponding relationship between the event type and the subscription identifier is established in advance, the detection device only needs to store the events detected during the communication interruption according to the event type once, which saves the storage space of the detection device compared to the storage method of storing the events detected during the communication interruption for each client separately. Of course, it is not necessary to achieve all the advantages described above at the same time to implement any product or method of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0076] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application, and for ordinary technicians in this field, other embodiments can also be obtained based on these drawings.
[0077] Figure 1 A flowchart of a method for resuming transmission after network disconnection provided by an embodiment of the present application;
[0078] Figure 2 A schematic diagram of the structure of the security system provided in the embodiment of the present application;
[0079] Figure 3 A schematic diagram of a first corresponding relationship provided in an embodiment of the present application;
[0080] Figure 4 A flowchart of a specific implementation method of step S101 is shown;
[0081] Figure 5 Another schematic diagram of the first corresponding relationship provided in the embodiment of the present application;
[0082] Figure 6 A schematic diagram of the communication relationship between the detection device and the client;
[0083] Figure 7 A schematic diagram of the signaling interaction process between the client and the detection device;
[0084] Figure 8 A flowchart of another method for resuming transmission after network disconnection provided by an embodiment of the present application;
[0085] Fig. 9 A schematic diagram of a network-disconnected transmission resuming device provided in an embodiment of the present application;
[0086] Fig.10 A schematic diagram of another network-disconnected transmission resuming device provided in an embodiment of the present application;
[0087] Fig.11 A schematic diagram of the structure of the detection device provided in the embodiment of the present application;
[0088] Fig.12 A schematic diagram of the structure of the client provided in an embodiment of the present application. DETAILED DESCRIPTION
[0089] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field based on the present application belong to the scope of protection of the present application.
[0090] The following is an explanation of the professional terms involved in the embodiments of this application:
[0091] Event: Information actively reported by the detection device. The event needs to be reported by the detection device to the client that subscribes to the event, and received and processed by the client. If the network between the detection device and the client is disconnected, the detection device can cache the event and report it again after the network is restored, that is, the event can be transmitted after the network is disconnected.
[0092] Event subscription: The client actively subscribes to the events of interest to the detection device. When the detection device detects the events subscribed by the client, it sends the events to the client.
[0093] Resume after network interruption: When communication with the client is interrupted, the detection device will actively record the time of communication interruption and continue event detection during the communication interruption. After communication with the client is restored, the detection device uploads the events detected during the communication interruption to the client.
[0094] Subscription ID: During an event subscription process, the client generates an ID that uniquely identifies the client.
[0095] In order to transmit the events recorded by the detection device during the communication interruption to the client, the present application provides a method, device, system, detection device, client, computer-readable storage medium and computer program product for resuming transmission after network interruption. The following first introduces a method for resuming transmission after network interruption provided in an embodiment of the present application.
[0096] A method for resuming transmission after network disconnection provided in an embodiment of the present application is applied to a detection device in a security system, and the security system also includes at least one client that communicates with the detection device.
[0097] like Figure 1 As shown, the method includes:
[0098] S101: After detecting that communication with a first client is interrupted, storing events of an event type subscribed by the first client detected during the communication interruption.
[0099] The first client is at least one of the clients.
[0100] S102: Receive a resume request sent by a second client, and determine a target event type corresponding to the target subscription identifier based on a target subscription identifier included in the resume request and a first correspondence between a pre-recorded event type and a subscription identifier.
[0101] The second client is at least one of the first clients, and the resume request is sent by the second client after communication is restored.
[0102] S103: Sending a target event of the target event type included in the stored events to the second client.
[0103] It can be seen that in the solution provided by the embodiment of the present application, the security system may include a detection device and at least one client communicating with the detection device. After detecting that the communication with the first client is interrupted, the detection device may store the event of the event type subscribed by the first client detected during the communication interruption, wherein the first client is at least one of the clients; receive a resume request sent by the second client, and determine the target event type corresponding to the target subscription identifier based on the target subscription identifier included in the resume request and the first correspondence between the pre-recorded event type and the subscription identifier, wherein the second client is at least one of the first clients, and the resume request is sent by the second client after the communication is restored; and then send the target event of the target event type included in the stored event to the second client.
[0104] Since the subscription identifiers sent by each client to the detection device are consistent before and after the communication interruption, and the subscription identifier will not change with the device update of the client, the change of the communication environment of the client, etc., the detection device can accurately identify the client based on the subscription identifiers of each client stored by itself and the subscription identifiers sent by the client after the communication is restored, and continue to transmit the events recorded during the communication interruption to the client, thus realizing the event interruption and transmission of the client. In addition, since the first corresponding relationship between the event type and the subscription identifier is established in advance, the detection device only needs to store the events detected during the communication interruption according to the event type once, which saves the storage space of the detection device compared to the storage method of storing the events detected during the communication interruption for each client separately.
[0105] A structural diagram of a security system provided in an embodiment of the present application is as follows Figure 2 As shown, the security system may include a detection device 100 and at least one client 200 communicating with the detection device 100 , namely, client 1 , client 2 to client n.
[0106] Among them, the detection device can be an image acquisition device, which can acquire image data of the defense area and perform event detection on the acquired image data; the detection device can also be an electronic device that communicates with the image acquisition device that acquires image of the defense area, and the detection device can obtain the image data of the defense area acquired by the image acquisition device, and perform event detection on the acquired image data.
[0107] For each event subscription, each client can generate a subscription identifier for uniquely identifying the client, and send the subscription identifier when subscribing to the event to the detection device, so that the detection device receives the subscription identifier of the client and the event type of the event to which the client wants to subscribe, records the correspondence between the subscription identifier of the client and the event type of the event to which the client wants to subscribe, and obtains the first correspondence between the subscription identifier of each client and the event type.
[0108] According to the above-mentioned first correspondence, when a communication connection is detected with a client, the detection device can send events of the event type to which the detected client has subscribed to to the client in real time. When a communication interruption is detected with the client, the detection device can store events of the event type to which the detected client has subscribed during the communication interruption, and when the communication is restored, continue to transmit the events stored during the communication interruption to the client.
[0109] As an implementation manner, for each client, when the client subscribes to events of different event types for the detection device at different times, the subscription identifiers sent may be different or the same.
[0110] In the above step S101, after detecting that the communication with the first client is interrupted, the detection device may store an event of an event type subscribed by the first client detected during the communication interruption. The first client is at least one of the clients.
[0111] The detection device can detect the communication connection status between itself and each client, and after detecting the interruption of communication with the first client among the clients that subscribe to events, record the time point of the communication interruption. The first client is at least one of the clients that subscribe to events for the detection device. The communication interruption means that the detection device cannot establish a communication connection with the first client, and the communication interruption may be caused by the network interruption of the detection device itself and / or the network interruption of the client.
[0112] As an implementation method, after each client subscribes to an event of the detection device, the detection device can establish a communication connection with each client and receive a heartbeat message sent by the client to the detection device according to a preset period. After receiving the heartbeat information, the detection device can return a response message to the client within a preset duration; if the heartbeat information sent by the client is not received according to the preset period, the detection device can determine that the communication with the client is interrupted. Among them, the preset period can be set according to actual needs, for example, 0.1 seconds, 1 second, etc., which is not specifically limited here; and the preset duration can be set according to actual needs, for example, 0.1 seconds, 1 second, etc., which is not specifically limited here.
[0113] As an implementation method, after each client subscribes to an event of the detection device, the detection device can transmit data with each client, and the detection device can obtain the data transmission rate between the client and the detection device in real time, and determine that the communication with the client is interrupted when the data transmission rate is less than a preset threshold. The preset threshold can be set according to actual needs, for example, 5 bit / s (bits per second), 100 bit / s, etc., and is not specifically limited here.
[0114] During the communication interruption, the detection device may continue to detect events of the event type subscribed by the first client, and store the events of the event type subscribed by the first client detected during the communication interruption, wherein the event may include information such as event occurrence time and key frames.
[0115] After each client subscribes to an event on the detection device, the detection device can determine the subscription identifier and subscribed event type of each client, and establish a correspondence between the subscription identifier and the event type of each client, to obtain a first correspondence between the event type and the subscription identifier. During a period of interruption in communication with the first client, the detection device can continue to detect events of the event type corresponding to the subscription identifier of the first client based on the first correspondence.
[0116] For example, Figure 3 As shown, when the client 1 subscribes to an event for the detection device, the client 1 sends the generated subscription identifier 1, the subscribed event type 1 and the event type 2 to the detection device. The detection device can receive the subscription identifier 1 of the client 1, and the event type 1 and event type 2 subscribed by the client 1, and establish a corresponding relationship between the event type 1 and the subscription identifier 1, and a corresponding relationship between the event type 2 and the subscription identifier 1; when the client 2 subscribes to an event for the detection device, the client 2 sends the generated subscription identifier 2, the subscribed event type 2 and event type 3 to the detection device. The detection device can determine the subscription identifier 2 of the client 2, and the event type 2 and event type 3 subscribed by the client 2, and establish a corresponding relationship between the event type 2 and the subscription identifier 2, and a corresponding relationship between the event type 2 and the subscription identifier 2, and obtain a first corresponding relationship. Based on the first corresponding relationship, event type 1 is associated with subscription identifier 1, event type 2 is associated with subscription identifier 1 and subscription identifier 2 respectively, and event type 3 is associated with subscription identifier 2.
[0117] During the interruption of communication with the first client, when an event of the event type subscribed by the first client is detected, the detection device can store the detected event in the storage location corresponding to the event type, that is, the events detected during the interruption of communication with the first client are stored according to the event type, and the detection time of each event is recorded, so that each detected event only needs to be stored once, without the need to store each event separately in the storage location corresponding to each client subscribing to the event type. For example, the first client is client A and client B, and client A and client B both subscribe to event type C. During the interruption of communication with client A and client B, the detection device can store the detected events D and E belonging to event type C in the storage area corresponding to event type C according to the event type, without storing event D and event E in the storage area corresponding to client A, and store event D and event E in the storage area corresponding to client B, thereby saving the storage space of the detection device.
[0118] In addition, each time the detection device detects an event of an event category subscribed by any client, it can directly display a preset light or play a preset sound to prompt the user that a subscribed event has been detected.
[0119] Furthermore, in the above step S102, the detection device may receive a retransmission request sent by the second client, and determine the target event type corresponding to the target subscription identifier based on the target subscription identifier included in the retransmission request and the first correspondence between the pre-recorded event type and the subscription identifier. The second client is at least one of the first clients, and the retransmission request is sent by the second client after communication is restored.
[0120] The client can detect the communication connection status with the detection device, so that the second client among the first clients whose communication with the detection device is interrupted can send a resume request including the target subscription identifier of the client to the detection device after detecting that the communication with the detection device is restored.
[0121] The second client may be at least one of the first clients, that is, the second client may be some of the first clients or all of the first clients, which is not specifically limited here.
[0122] As an implementation mode, the above-mentioned retransmission request may also include communication information such as the client's current network IP, port information, and the event type subscribed by the client.
[0123] As an implementation method, after subscribing to an event of a detection device, the client can send a heartbeat message to the detection device according to a preset period, and after receiving the heartbeat message, the detection device returns a response message to the client within a preset time period; if the response message returned by the detection device is not received within the preset time period, the client can determine that the communication with the detection device is interrupted. After detecting that the communication with the detection device is interrupted, the client can continue to send heartbeat messages to the detection device according to the preset period, and when receiving the response message returned by the detection device, send a resume request including a subscription identifier to the detection device.
[0124] The detection device can receive the retransmission request sent by the second client, record the communication recovery time point, and search for the event type corresponding to the target subscription identifier in the subscription request in the first correspondence between the pre-recorded event type and the subscription identifier to obtain the target event type corresponding to the target subscription identifier.
[0125] The subscription ID is an ID generated by the client for event subscription. During an event subscription process, the subscription ID will not change due to device updates of the client, changes in the communication environment of the client, etc.
[0126] Based on the fact that the subscription identifier sent by the second client to the same detection device before and after the communication interruption is consistent, after receiving the target subscription identifier sent by the second client when the network is restored, the detection device can uniquely identify the second client based on the target subscription identifier, and determine the target event type corresponding to the target subscription identifier based on the target subscription identifier and the first corresponding relationship between the event type and the subscription identifier.
[0127] For example, Figure 3 As shown, the detection device has pre-recorded the first correspondence between the event type and the subscription identifier. After the communication between the client 1 and the detection device is interrupted and then restored, the client 1 can send a retransmission request including the subscription identifier 1 to the detection device. The detection device can receive the retransmission request sent by the client 1, and then search for the subscription identifier 1 in the first correspondence between the event type and the subscription identifier, and determine the event type 1 and event type 2 corresponding to the subscription identifier 1.
[0128] Then in the above step S103, the detection device may send the target event of the target event type included in the stored events to the second client.
[0129] After determining the target event type corresponding to the target subscription identifier of the second client, the detection device can further determine the target event of the target type event included in the events stored by itself, wherein the target event is the event detected during the communication interruption with the second client.
[0130] That is to say, the detection device can store the events detected during the interruption of communication with the first client according to the event type. When receiving the resume request sent by the second client in the first client after the communication is restored, the target event type corresponding to the target subscription identifier of the second client can be filtered out from each event type according to the first correspondence between the pre-recorded subscription identifier and the event type, and the target event stored during the interruption of communication with the second client can be filtered out from each event of the target event type stored in itself. The target event is the event that needs to be resumed to the second client.
[0131] After determining the target event that needs to be retransmitted to the second client, the detection device can transmit the target event to the second client through the communication link that receives the retransmission request of the second client. The second client can receive the target event, so that the purpose of retransmitting the event subscribed by the second client detected during the communication interruption with the second client to the second client after the communication is restored is achieved, thereby avoiding the omission of events caused by the communication interruption.
[0132] Among them, the detection device can record the time point when the communication with each first client is interrupted, the time point when the communication with each second client is restored, and the time point when each event is detected. The above-mentioned target event can be an event of the target event type detected during the communication interruption with the second client determined by the detection device based on the time points recorded by itself.
[0133] For example, Figure 3 As shown, client 1 subscribes to event type 1 and event type 2. During the interruption of communication with client 1, the detection device detects and stores target event F, target event G and target event H, and can determine the correspondence between target events and event types. Among them, target event F belongs to one of event type 1, and target event G and target event H belong to one of event type 2 respectively. Optionally, target event F is stored in the storage area of event type 1, and target event G and target event H are stored in the storage area of event type 2; or the correspondence between target events and event types can be determined by indexing or the like. After receiving the retransmission request including the target subscription identifier 1 sent by client 1 after the communication is restored, the detection device can determine the event type 1 and event type 2 corresponding to the target subscription identifier 1, and determine the target event F, target event G and target event H stored during the interruption of communication with client 1 in each event of event type 1 and event type 2 stored in itself, and retransmit the target event F, target event G and target event H to client 1.
[0134] In this embodiment, since the subscription identifiers sent by each client to the detection device are consistent before and after the communication interruption, and the subscription identifier will not change with the device update of the client, the change of the communication environment of the client, etc., the detection device can accurately identify the client based on the subscription identifiers of each client stored by itself and the subscription identifiers sent by the client after the communication is restored, and continue to transmit the events recorded during the communication interruption to the client, thereby realizing the event interruption and continued transmission of the client. In addition, since the first corresponding relationship between the event type and the subscription identifier is established in advance, the detection device only needs to store the events detected during the communication interruption according to the event type once, which saves the storage space of the detection device compared to the storage method of storing the events detected during the communication interruption for each client separately.
[0135] As an implementation example of the present application, the target subscription identifier is the same as the subscription identifier used by the second client when communication is normal, or the target subscription identifier is different from the subscription identifier used by the second client when communication is normal, wherein the subscription identifier used when communication is normal is the subscription identifier used to send subscription events to the second client in real time when communication with the second client is normal.
[0136] The target subscription identifier sent by the second client when detecting that communication is restored is used to detect that the device identifies the second client through the target subscription identifier, and associates the second client with the subscription request sent by the second client, so as to facilitate the resumption of event transmission of the second client after network disconnection, and real-time event transmission when subsequent communication is restored to normal.
[0137] The target subscription identifier and the subscription identifier used by the second client when the communication is normal may be the same or different. The subscription identifier used when the communication is normal is the subscription identifier used by the detection device to send subscription events to the second client in real time when the communication with the second client is normal. The subscription identifier used by the second client when the communication is normal.
[0138] That is to say, the target subscription identifier can be a subscription identifier that the second client uses only for resuming event transmission after network disconnection, that is, the target subscription identifier and the subscription identifier used when the second client and the detection device transmit real-time events are two different identifiers; or, the target subscription identifier can also be a subscription identifier that the second client uses for real-time event transmission and resuming event transmission after network disconnection, that is, the subscription identifier used by the second client for resuming event transmission after network disconnection can be the same identifier as the subscription identifier used by the second client for real-time event transmission.
[0139] As an implementation mode, the subscription identifier received by the detection device when receiving the subscription request sent by the second client may be different from the target subscription identifier received when receiving the resume request sent by the second client. The target subscription identifier is an identifier in the subscription identifier used for resuming the event after network disconnection. The subscription identifier carried in the subscription request sent by the second client may include the target subscription identifier, and the first correspondence between the event type and the subscription identifier established by the detection device may include a correspondence between the event type and the target subscription identifier in the subscription identifier.
[0140] When the second client detects that the communication with the detection device is restored, it can send a retransmission request carrying only the target subscription identifier to the detection device. After receiving the retransmission request, the detection device can search for the subscription identifier including the target subscription identifier in the stored subscription identifiers of each client to identify the second client, and then determine the target event type corresponding to the target subscription identifier based on the subscription identifier of the second client corresponding to the target subscription identifier and the first corresponding relationship between the pre-recorded event type and the subscription identifier, and send the target event of the target event type included in the stored event to the second client.
[0141] Exemplarily, the subscription identifier carried by the subscription request sent by the second client may include real-time communication identifiers such as the IP address and port information of the second client, as well as a target subscription identifier. When communication is normal, the detection device can use the subscription identifier or only use the communication identifier in the subscription identifier to send subscription events to the second client in real time. When the second client detects that the communication is restored after an interruption, it can send a resume request carrying only the target subscription identifier to the detection device. The detection device can identify the second client based on the target subscription identifier and the recorded subscription identifiers of each client, and resume the event after the network is disconnected.
[0142] In addition, the target subscription identifier can be a subscription identifier that is only used by the second client for event network resumption subscription, that is, the target subscription identifier and the subscription identifier used when the second client subscribes to real-time events with the detection device are two different identifiers; or, the target subscription identifier can also be a subscription identifier used by the second client for real-time event subscription and event network resumption subscription, that is, the subscription identifier used by the second client for event network resumption subscription is the same identifier as the subscription identifier used by the second client for real-time event subscription.
[0143] That is to say, for any client, the subscription identifier used by the client for event disconnection and network resumable subscription and the subscription identifier used by the client for real-time event subscription can be the same identifier or different identifiers.
[0144] As an implementation mode, for any client, the subscription identifier used by the client for subscription of network-breaking and network-resuming transmission is different from the subscription identifier used by the client for real-time event subscription. When the user subscribes to the event of the detection device supporting network-breaking and network-resuming transmission through the client, the client can generate a subscription identifier for event network-breaking and network-resuming transmission, and send a subscription request carrying the subscription identifier to the detection device. When the detection device receives the subscription request, it can receive the subscription identifier of the client and the event type of the event to be subscribed by the client, record the corresponding relationship between the subscription identifier of the client and the event type of the event to be subscribed by the client, and obtain the first corresponding relationship between the subscription identifier of each client and the event type. Then, when the communication connection with the client is detected, the detection device can store the event of the event type subscribed by the client detected during the communication interruption according to the first corresponding relationship, and when the renewal request carrying the subscription identifier sent by the client when the communication is restored is received again, the event stored during the communication interruption is transmitted to the client.
[0145] When the user subscribes to the real-time event of the detection device through the client, the client sends a subscription request carrying the application layer identifier to the detection device. When the detection device receives the subscription request, it can receive the application layer identifier of the client and the event type of the event to which the client wants to subscribe, record the correspondence between the application layer identifier of the client and the event type of the event to which the client wants to subscribe, obtain the third correspondence between the application layer identifier of each client and the event type, and according to the third correspondence, when the communication connection with the client is detected, the detection device can send the event of the event type subscribed by the detected client to the client in real time; when the communication interruption with the client is detected, the detection device can delete the third correspondence and end the subscription event corresponding to the application layer identifier. The application layer identifier can include the IP address and port information of the client, etc., which are not specifically limited here.
[0146] In this case, the subscription identifier generated by the client for event network disconnection subscription resuming can be called the resuming identifier. The subscription identifier obtained by the detection device when receiving the subscription request sent by the client is the same as the target subscription identifier obtained when receiving the resuming request sent by the client. The resuming identifier is an identifier generated by the client during an event subscription process to uniquely identify the client. During an event subscription process, the subscription identifier will not change with changes in the client deployment environment.
[0147] When the client subscribes to an event on the detection device, it sends a subscription identifier. If the communication between the detection device and the client is interrupted, once the communication is detected to be restored, the client will send the same subscription identifier again, so that the detection device can uniquely identify the client through the subscription identifier and resume the events subscribed by the client stored during the communication interruption. In this case, the client only generates a resume identifier when receiving the user's instruction to resume the subscription after network disconnection, and uses the resume identifier to subscribe to events on the detection device. However, it is not necessary to generate the resume identifier when subscribing to real-time events, thereby improving the processing efficiency of the device.
[0148] As an implementation mode, for any client, the subscription identifier used by the client for event disconnection and network resuming subscription can be the same as the subscription identifier used by the client for real-time event subscription. In this case, the subscription identifier obtained by the detection device when receiving the subscription request sent by the client is the same as the target subscription identifier obtained when receiving the resuming request sent by the client.
[0149] When a user subscribes to an event of a detection device through a client, the client can generate a subscription identifier and send a subscription request carrying the subscription identifier to the detection device. When the detection device receives the subscription request, it can receive the subscription identifier of the client and the event type of the event to which the client wants to subscribe, record the correspondence between the subscription identifier of the client and the event type of the event to which the client wants to subscribe, and obtain the first correspondence between the subscription identifier of each client and the event type.
[0150] The detection device can send events of the event type subscribed by the client that are detected in real time to each client based on the first correspondence; it can also store events of the event type subscribed by the client based on the first correspondence when a communication connection with the client is detected, and upon receiving a renewal request carrying a subscription identifier sent by the client when communication is restored, continue to transmit to the client the events of the event type subscribed by the client that were detected during the stored communication interruption.
[0151] In this embodiment, the target subscription identifier sent by the second client to the detection device when communication is restored after communication interruption may be the same as or different from the subscription identifier used by the detection device to send subscription events to the second client in real time when communication is normal. In the case where the target subscription identifier sent by the second client to the detection device when communication is restored after communication interruption is the same as the subscription identifier used by the detection device to send subscription events to the second client in real time when communication is normal, the subscription identifier of the second client remains unchanged before and after the communication interruption, and the detection device can always identify the second client through one subscription identifier; and in the case where the target subscription identifier sent by the second client to the detection device when communication is restored after communication interruption is different from the subscription identifier used by the detection device to send subscription events to the second client in real time when communication is normal, the detection device needs to identify the client before and after the communication interruption based on the target subscription identifier, thereby avoiding the situation where the client identity cannot be identified due to the change of the subscription identifier used for sending subscription events in real time.
[0152] As an implementation method of the present application, Figure 4 As shown, before the above step S101, that is, the step of storing events of the event type subscribed by the first client detected during the communication interruption after detecting the communication interruption with the first client, a method for resuming transmission after network disconnection provided in an embodiment of the present application may also include:
[0153] S401: receiving subscription requests sent by various clients.
[0154] The subscription request includes the subscription identifier of the client and the event type of the event to be subscribed, and the subscription identifier is an identifier generated by the client and used to uniquely identify the client.
[0155] S402: Associating the event type with the subscription identifier of each client that has subscribed to the event type, to obtain a first corresponding relationship between the event type and the subscription identifier of each client.
[0156] For each client, when it is desired to subscribe to an event of a detection device through the client, the user can send an event subscription instruction about the detection device to the client. For example, the user can click the device identification, event type identification and event subscription identification of the detection device displayed on the display interface of the client, and send an event subscription instruction about the detection device to the client. The client can generate an identification for uniquely determining the client based on the above-mentioned event subscription instruction, and generate a subscription request including the subscription identification of the client and the event type of the event to be subscribed, and then send the subscription request to the detection device. The detection device can receive the subscription requests sent by each client, and record the corresponding relationship between the subscription identification of the client and the event type subscribed by each client.
[0157] According to the subscription requests of each client, for each event type, the detection device can associate the subscription identifiers of each client that subscribes to the event type with the event type to obtain the corresponding relationship between the event type and the subscription identifiers of each client that subscribes to the event type.
[0158] That is to say, the detection device pre-stores the event types that the detection device supports detection, and for each event type, the detection device associates the event type with the subscription identifier of the client that subscribes to the event type, obtains the correspondence between the event type and the subscription identifier of the client that subscribes to the event type, and then obtains the first correspondence between the event type and the subscription identifier of each client. In this way, after detecting each event, the subscription identifier corresponding to the event type of the event is determined according to the event type of the event and the first correspondence, and the event is sent to the client corresponding to the subscription identifier.
[0159] For example, Figure 5As shown, the event types that can be detected by the detection device include event type 1, event type 2, and event type 3. When receiving a subscription request for event type 1 and event type 2 sent from client 3, event type 1 is associated with subscription identifier 3 of client 3, and event type 2 is associated with subscription identifier 3 of client 3. When receiving a subscription request for event type 1, event type 2, and event type 3 sent from client 4, event type 1 is associated with subscription identifier 4 of client 4, event type 2 is associated with subscription identifier 4, and event type 3 is associated with subscription identifier 4. So far, event type 1 is associated with subscription identifier 3 and subscription identifier 4, event type 2 is associated with subscription identifier 3 and subscription identifier 4, and event type 3 is associated with subscription identifier 4.
[0160] In this embodiment, after receiving the subscription request sent by each client, the detection device can associate the event type with the subscription identifier of each client that subscribes to the event type according to the subscription identifier included in each subscription request and the event type of the event to be subscribed, and obtain the first correspondence between the event type and the subscription identifier. In this way, the detection device can clearly understand the situation of the client that subscribes to each event type. When detecting an event of a certain type of event, it can determine the subscription identifiers that subscribe to the event type by querying the first correspondence between the event type and the subscription identifier, that is, determine the clients that subscribe to the event of the event type. If the communication connection with each client is normal, the detected event of the event type is sent to each client that subscribes to the event in real time; if the communication with at least one client is interrupted, the event of the event type is stored, and after the subsequent communication is restored, the events of the event type are all transmitted to the client that subscribes to the event type after the communication is restored. By establishing a first correspondence between an event type and a subscription identifier, and storing events during a communication interruption according to the first correspondence, each event can be stored only once, saving internal storage space of the detection device. Compared with a situation in which events of the event type subscribed by a client are stored separately for each client according to the subscription situation of each client, waste of storage space caused by repeated storage of the same event can be avoided.
[0161] As an implementation of an embodiment of the present application, before the above step S201, that is, the step of receiving a subscription request sent by each client, a method for resuming transmission after network disconnection provided by an embodiment of the present application may further include:
[0162] When receiving the subscription identifier range acquisition instruction sent by each client, the range of subscription identifiers supported by the client is sent to the client, so that the client generates a subscription identifier suitable for the detection device within the range.
[0163] The user can pre-set the subscription identification range of the subscription identification supported by the detection device, and the subscription identification range is stored in the detection device. The subscription identification range may include the string length range of the subscription identification, the identification interval of the subscription identification, etc., which are not specifically limited here.
[0164] When subscribing to events for a detection device, the client can first send a subscription identifier range acquisition instruction to the detection device to clarify the subscription identifier range of the detection device so that the generated subscription identifier can be recognized and supported by the detection device. When the detection device receives the subscription identifier range acquisition instruction sent by the client, it can send the subscription identifier range of the subscription identifier supported by itself to the client.
[0165] After receiving the subscription identifier range issued by the detection device, the client can generate a subscription identifier suitable for the detection device based on the subscription identifier range and using the preset identifier generation rules. A subscription identifier suitable for the detection device is a subscription identifier that is within the subscription identifier range of the subscription identifiers supported by the detection device and can be recognized and supported by the detection device. Among them, the preset identifier generation rules can be set according to actual needs, such as RFC (Request For Comments) rules, etc., which are not specifically limited here.
[0166] As an implementation mode, the subscription identification range includes the string length range of the subscription identification, and the detection device can store the subscription identification list of the subscription identifications of each client received. When the subscription identification of any client is not received, the subscription identification list is an empty list without recording any identification information. Since the detection device uses the subscription identification as the identity of the client for deploying each subscription event, the detection device does not support different clients to send the same subscription identification to the detection device. Based on this, in order to avoid the failure of event deployment caused by the fact that the sent subscription identification is repeated with the subscription identification sent by other clients to the detection device and cannot be identified by the detection device, each client can first send a subscription identification range acquisition instruction and a subscription identification list acquisition instruction to the detection device. When the detection device receives the subscription identification range acquisition instruction and the subscription identification list acquisition instruction sent by the client, it can send the string length range of the subscription identification supported by itself and the subscription identification list stored by itself to the client, so that the client generates a subscription identification that is adapted to the subscription identification supported by the detection device and is different from the subscription identification recorded in the subscription identification list according to the string length range, and uses the subscription identification to deploy the event on the detection device.
[0167] As an implementation mode, the subscription identification range includes an identification interval of the subscription identification, and the detection device pre-stores the identification interval of the subscription identification. In order to facilitate the distinction and identification of each client that subscribes to the event of the detection device, the detection device does not support different clients to send the same subscription identification to the detection device. Based on this, the detection device can update the current identification interval of the subscription identification currently supported by itself according to the subscription identification included in the subscription request sent by the received client, and obtain the identification interval of the subscription identification currently supported by the detection device, wherein the identification interval of the subscription identification currently supported by the detection device is the subscription identification that can currently be used to deploy the event of the detection device. In other words, the identification interval of the subscription identification supported by the detection device at different times changes with the change of the subscription identification sent by the client that subscribes to the event of the detection device.
[0168] For example, the initial identification interval of the subscription identifiers supported by the detection device is [AA1-AA100]. As the number of clients subscribing to events of the detection device increases, the current identification intervals of the subscription identifiers currently supported by the detection device are [AA1-AA50] and [AA60-AA76]. That is to say, the detection device can currently support receiving subscription identifiers within the intervals [AA1-AA50] and [AA60-AA76], but no longer supports receiving subscription identifiers outside the intervals [AA1-AA50] and [AA60-AA76].
[0169] For each client, the subscription identifier generated by the client based on the current subscription identifier range sent by the detection device is within the subscription identifier range of the subscription identifiers supported by the detection device, and the subscription identifier is different from the subscription identifiers of other clients currently received by the detection device, so that the detection device can identify the client using the subscription identifier sent by the client.
[0170] In this embodiment, before each client sends a subscription request to the detection device, it can first send a subscription identifier range acquisition instruction to the detection device. When the detection device receives the subscription identifier range acquisition instruction sent by each client, it can send the range of subscription identifiers supported by itself to the client, so that the subscription identifiers generated by the client are all within the range of subscription identifiers supported by the detection device. Further, in order to avoid the detection device receiving duplicate subscription identifiers, the detection device can also update the current subscription identifier range currently supported by itself according to the subscription identifiers received by itself, and avoid different clients generating duplicate subscription identifiers about the detection device by sending the current subscription identifier range to the client, so that the subscription identifiers of each client stored in the detection device are different, which is convenient for the detection device to distinguish each client through the subscription identifier of each client. In this way, even if the deployment environment of the client changes, the detection device can also identify the client and perform event disconnection and network continuation transmission for the client.
[0171] As an implementation method of the embodiment of the present application, the detection device supports storing events corresponding to the retransmission paths of the preset retransmission paths at the same time, and each client corresponds to a retransmission path;
[0172] After the above step S201, i.e., the step of receiving the subscription request sent by each client, the method for resuming transmission after network disconnection provided by the embodiment of the present application may further include:
[0173] If the current retransmission path reaches the preset number of retransmission paths, based on the pre-set priorities of each client, determine the client to be cancelled from the clients to which the retransmission path has been allocated; release the retransmission path corresponding to the client to be cancelled, and allocate the released retransmission path to the client that sent the subscription request.
[0174] In order to achieve the event transmission after network disconnection, the detection device needs to store the events of each event type subscribed by each first client detected during the communication interruption with the first client. In this case, storing events may take up a large amount of memory space, and in some cases, even affect the detection device's real-time transmission of events subscribed by other clients, thereby affecting the overall efficiency of the security system.
[0175] Based on this, in order to avoid the impact of network disconnection on the detection device, the detection device can be pre-set in terms of the number of retransmission paths, that is, the preset number of retransmission paths of the retransmission paths supported by the detection device at the same time. Among them, each client corresponds to a retransmission path. The preset number of retransmission paths can be set according to the performance of the detection device, for example, 10, 20, etc., which are not specifically limited here. In addition, the number of retransmission paths of the detection device can be set when the detection device leaves the factory. For example, when leaving the factory, the number of retransmission paths of the detection device is set to 10 retransmission paths; it can also be adjusted by the client according to the needs of the security scene and the device parameter settings of the detection device during the use of the detection device. For example, the device parameters of the detection device indicate that the maximum number of retransmission paths supported by the detection device is 20, and the number of retransmission paths of the detection device currently set is 5. If the security scene requires it, the client can adjust the number of retransmission paths of the detection device to 15.
[0176] That is to say, the detection device only supports storing events corresponding to the resume paths of a preset number of resume paths at the same time. Accordingly, the detection device only supports event network disconnection resume for clients of the preset number of resume paths at the same time.
[0177] Since the number of retransmission paths supported by the detection device at the same time is limited, a retransmission path can be allocated to the client that subscribes to the event of the detection device according to the priority of each client. Based on this, the priority of each client in the security scenario can be pre-set according to the security scenario used by the detection device, and the pre-set priority of each client can be stored in the detection device. In this way, the detection device can allocate a retransmission path to each client according to the subscription request received from each client. Each subscription request includes the priority of the client that sends the subscription request.
[0178] As an implementation mode, the detection device may preferentially allocate a retransmission path to each client that sends a subscription request first according to the order of the received subscription requests, and subsequently allocate and adjust the retransmission path based on the priority of each client.
[0179] When receiving the subscription request from each client, the detection device can determine whether the current retransmission path has reached the preset number of retransmission paths to manage the retransmission path.
[0180] If the current retransmission path reaches the preset number of retransmission paths, the detection device can determine, based on the preset priorities of each client, a client with a lower priority than the client that sent the subscription request from the clients that have been assigned the retransmission path as the client to be cancelled. The detection device can then release the retransmission path corresponding to the client to be cancelled and allocate the released retransmission path to the client that sent the subscription request.
[0181] If the current resuming path reaches the preset number of resuming paths, and the detection device determines, based on the pre-set priorities of each client, that the client sending the subscription request is lower than the clients to which the resuming path has been allocated, then the detection device does not need to adjust the resuming path, and can send a notification message to the client that subscribed to the request to prompt that there is no resuming path to be allocated, so that the client receives the notification message and displays the notification message, so that the administrator of the client can clearly understand that the detection device does not support the event of network disconnection resuming for the client.
[0182] As an implementation method, in the deployment scenario of the security system, the various clients that the security system can communicate with the detection device are known, so the priority of each client is also known. For example, the security system is applied to a railway station, and the various clients in the system include security equipment clients in the security rooms on each floor, clients of railway departments at all levels, clients of fire departments, and clients of public security maintenance departments, etc. The priority of each client is pre-set by the administrator of the security system. The administrator can store the pre-set priorities of each client in the detection device so that the detection device can allocate a retransmission path to each client based on the priority of each client. When receiving a subscription request sent by a client of the public security maintenance department, the detection device can obtain the priority carried by the subscription request. If the current retransmission path has reached the preset number of retransmission paths, the detection device can determine the security equipment client in the client that has been allocated the retransmission path as a client to be cancelled based on the pre-set priority; release the retransmission path corresponding to the security equipment client, and allocate the released retransmission path to the client of the public security maintenance department.
[0183] As an implementation method, in the deployment scenario of the security system, each client in the security system that can communicate with the detection device is known, and then, the priority of each client is also known. The manager can pre-set the priority of each client, and store the pre-set priority of each client in each client and the detection device. Among them, the client with high priority can obtain the subscription identification of the client with low priority, and perform event subscription management on the client with low priority. The detection device can allocate a retransmission path to each client according to the priority carried in the subscription request sent by each client. When receiving the subscription request sent by the client, if the current retransmission path has reached the preset number of retransmission paths, the detection device can send a notification message to the client that sent the subscription request to prompt that there is no retransmission path to be allocated. After receiving the notification message, the client can request the retransmission path allocation list from the detection device, and receive the retransmission path allocation list returned by the detection device.
[0184] In this way, after receiving the notification message sent by the detection device, the client can determine the client with a lower priority than the client among the clients recorded in the resuming path allocation list based on the resuming path allocation list returned by the detection device and the priority of each client stored in advance, as the client to be cancelled, and send a release resuming path request including the subscription identifier of the client to be cancelled, its own priority and the priority of the client to be cancelled to the detection device. The detection device receives the release resuming path request for the client to be cancelled sent by the client, and verifies the priority of the client and the client to be cancelled. When it is determined that the priority of the client is higher than the priority of the client to be cancelled, the detection device releases the resuming path corresponding to the client to be cancelled, and allocates the released resuming path to the client.
[0185] As an implementation mode, before sending a subscription request to the detection device, the client may send a query request for the number of remaining retransmission paths to the detection device, and when the detection device receives the query request for the number of remaining retransmission paths, it may send the number of remaining retransmission paths to the client. When the remaining retransmission paths are 0, the client may request the detection device for a retransmission path allocation list, and receive the retransmission path allocation list returned by the detection device. In this way, the client may determine the client with a priority lower than that of the client among the clients recorded in the retransmission path allocation list based on the retransmission path allocation list and the priorities of the pre-stored clients, as the client to be cancelled, and send a release retransmission path request including the subscription identifier of the client to be cancelled, its own priority and the priority of the client to be cancelled to the detection device, and send a subscription request including its own subscription identifier and its own priority to the detection device. The detection device may receive the release retransmission path request sent by the client to determine the client to be cancelled, and when it is determined that the priority of the client is higher than the priority of the client to be cancelled, release the retransmission path corresponding to the client to be cancelled, and allocate the released retransmission path to the client.
[0186] Before sending a subscription request to the detection device, the client may also request the detection device for the total number of resume transmission channels supported by the detection device and the number of resume transmission channels currently occupied by the detection device. In this way, the detection device can return the total number of resume transmission channels supported and the number of resume transmission channels currently occupied by the detection device, so that the client can send a subscription request to the detection device based on the total number of resume transmission channels supported by the detection device and the number of resume transmission channels currently occupied by the detection device.
[0187] As an implementation method, the detection device stores a subscription identification list, which records the subscription identification of each client that currently subscribes to events for the client, and records the correspondence between the subscription identification and the retransmission path. Before each client sends a subscription request to the detection device, it can request the detection device for a preset number of retransmission paths and a subscription identification list to determine the total number of retransmission paths supported by the detection device and the allocation of retransmission paths. The detection device can return the preset number of retransmission paths and the subscription identification list, and the client can determine the currently available number of retransmission paths based on the preset number of retransmission paths and the subscription identification list.
[0188] When the currently available number of retransmission paths is not 0, the client can generate a subscription identifier and send a subscription request carrying the subscription identifier to the detection device. When the detection device receives the subscription request sent by the client, it can allocate a retransmission path for the client and record the subscription identifier of the client and the correspondence between the subscription identifier and the retransmission path in the subscription identifier list.
[0189] When the number of currently available resuming paths is 0, the client can determine the client with a lower priority among the clients assigned with the resuming path based on the pre-stored priorities of each client and the correspondence between the subscription identifier and the resuming path recorded in the subscription identifier list, as the client to be cancelled. The client can then generate a request to release the resuming path that carries the subscription identifier of the client to be cancelled, the priority of the client to be cancelled, and its own priority, and send a subscription request including its own subscription identifier and its own priority to the detection device. The detection device can receive the request to release the resuming path sent by the client to determine the client to be cancelled, and when it is determined that the priority of the client is higher than the priority of the client to be cancelled, release the resuming path corresponding to the client to be cancelled, allocate the released resuming path to the client, and record the subscription identifier of the client and the correspondence between the subscription identifier and the resuming path in the subscription identifier list.
[0190] Alternatively, when the number of currently available retransmission paths is 0, the client can send a subscription request carrying its own priority and subscription identifier to the detection device. The detection device can obtain the priority carried by the subscription request, and based on the pre-stored client priorities, determine the clients with lower priorities among the clients that have been allocated retransmission paths as clients to be cancelled, release the retransmission paths corresponding to the clients to be cancelled, allocate the released retransmission paths to the client that sent the subscription request, and update the recorded correspondence between the subscription identifier and the retransmission path.
[0191] Exemplarily, before sending a subscription request to the detection device, the client can request the detection device for a preset number of retransmission paths and a subscription identifier list, and receive the preset number of retransmission paths and the subscription identifier list returned by the detection device. If the preset number of retransmission paths is 10, and the subscription identifier list records the correspondence between 8 groups of subscription identifiers and retransmission paths, then the currently available number of retransmission paths is 2, and the client can send a subscription request carrying its own subscription identifier to the detection device, so that after receiving the subscription request, the detection device can allocate a retransmission path for the client and record the correspondence between the client's subscription identifier and the retransmission path. If the preset number of resume paths is 10, and the subscription identifier list records the correspondence between 10 groups of subscription identifiers and resume paths, then the currently available number of resume paths is 0. The client can send a subscription request carrying its own priority and subscription identifier to the detection device, so that the detection device, based on the priority of the client and the priority of the pre-stored client, determines the client with a lower priority among the clients to which the resume path has been allocated as the client to be cancelled, releases the resume path corresponding to the client to be cancelled, allocates the released resume path to the client that sent the subscription request, and updates the recorded correspondence between the subscription identifier and the resume path.
[0192] As an implementation method, the client can send a retransmission path release request to the detection device. When the detection device receives the retransmission path release request sent by each client, it can release the retransmission path occupied by the client and allocate the retransmission path as an available retransmission path to other clients.
[0193] Moreover, after releasing the retransmission path of the client based on the retransmission path release request, the detection device can still detect events of the event type subscribed by the client in real time and send the real-time detected events to the client; when it is detected that the communication with the client is interrupted, the detection device does not need to resume the event transmission to the client.
[0194] As an implementation method, each client that subscribes to an event of a detection device may also send a cancellation request carrying a subscription identifier to the client. When the detection device receives the cancellation request sent by each client, it may release the retransmission path occupied by the client and allocate the retransmission path as an available retransmission path to other clients.
[0195] In this embodiment, in order to avoid that the event of network disconnection and resuming transmission occupies too much memory space of the detection device, affecting the real-time transmission of events between the detection device and other clients, the detection device can be pre-set to support the simultaneous storage of events with a preset number of resuming transmission paths. In this way, after receiving the subscription request sent by each client, if the current resuming transmission path reaches the preset number of resuming transmission paths, the detection device can determine the client to be cancelled from the clients to which the resuming transmission path has been allocated based on the pre-set priority of each client, release the resuming transmission path corresponding to the client to be cancelled, and allocate the released resuming transmission path to the client that sent the subscription request. In this way, the detection device can achieve reasonable allocation of the resuming transmission path by allocating and adjusting the resuming transmission path by utilizing the priority between each client, and avoid that the event of network disconnection and resuming transmission occupy too much resources, taking into account the event of network disconnection and resuming transmission and real-time event subscription, and improving the overall efficiency of the security system.
[0196] As an implementation of the embodiment of the present application, the detection device stores events of each event type non-repeatedly.
[0197] The above step S101, i.e., the step of storing events of the event type subscribed by the first client detected during the communication interruption after the communication interruption with the first client is detected, may include:
[0198] After detecting that communication with a first client is interrupted, for each event of an event type subscribed by the first client detected during the communication interruption, the event is stored only once, wherein the first client includes a plurality of clients;
[0199] The above step S103, i.e. the step of sending the target event of the target event type included in the stored events to the second client, may include:
[0200] The target event of the target event type included in each event stored only once is sent to each second client respectively.
[0201] During the period when the communication interruption with the first client is detected, the detection device stores an event of the event type subscribed by the detected first client in a storage area of the corresponding event type according to the event type of the event without duplication, that is, for each event detected during the communication interruption, the event is stored only once, rather than repeatedly stored multiple times according to the number of clients that have subscribed to the event type of the event.
[0202] After detecting that the communication with the first client is interrupted, and in the case that the first client includes multiple clients, each event of the event type subscribed by each first client detected during the communication interruption is stored only once.
[0203] Furthermore, in the case of receiving a resume request sent by each second client in the first client, the detection device may send the target event of the target event type included in each event that is stored only once by itself to each second client respectively.
[0204] In this way, compared with the storage method of storing events of the event type subscribed by each client separately after detecting the interruption of communication with the client according to the subscription request of each client, for each time detected during the communication interruption, regardless of the number of clients subscribing to the event type corresponding to the event is one or more, the detection device stores the event once without having to store the event multiple times according to the number of clients, which can avoid repeated storage of the same event and improve the reuse rate of the same event. In addition, by using the first corresponding relationship between the event type and the subscription identifier, the events included in the event type subscribed by the subscription identifier can be quickly located according to the subscription identifier of the client, and then in each event of the event type, the target event with the storage time during the interruption of communication with the client is determined, and the target event is transmitted to the client. While ensuring the efficiency of the event transmission after the network is disconnected, the storage resources of the detection device are saved.
[0205] For example, Figure 3 As shown, client 1 subscribes to events of event type 1 and event type 2. Client 2 subscribes to events of event type 2. The detection device can record the first correspondence between subscription identifier 1 of client 1 and event type 1, subscription identifier 1 and event type 2, and subscription identifier 2 of client 2 and event type 2.
[0206] During the period of communication interruption with client 1 and client 2, the detection device detected target event F belonging to event type 1, target event G and target event H belonging to event type 2, and the detection device stored the detected target event F, target event G and target event H only once, that is, the detection device stored the target event F, target event G and target event H in the storage area of the event type to which the events belong, instead of storing the target event G and target event H once for client 1 and once for client 2, thereby avoiding repeated storage of target event G and target event H and saving storage resources.
[0207] In this way, when receiving a retransmission request including subscription identifier 1 sent by client 1 after communication is restored, the detection device can determine that the event types of the events that need to be sent to client 1 are event type 1 and event type 2 according to the above-mentioned first corresponding relationship, and then it is necessary to send target event F, target event G, and target event H to client 1. Furthermore, the detection device can send target event F, target event G, and target event H that are only stored once to client 1.
[0208] Similarly, when the client 2 sends a retransmission request including subscription identifier 2 after the communication is restored, the detection device determines that the event type of the event to be sent to the client 2 is event type 2 according to the first corresponding relationship, and then the target event G and the target event H need to be sent to the client 2. At this time, the detection device still sends the target event G and the target event H, which are only stored once, to the client 2.
[0209] In this embodiment, the detection device does not store events of each event type repeatedly, thereby saving storage resources of the detection device and achieving high reuse of each event.
[0210] As an implementation method of the embodiment of the present application, each event has an event identifier for uniquely identifying the event;
[0211] Before the above step S102, i.e., the step of receiving the resume transmission request sent by the target client, the method for resuming transmission after network disconnection provided by the embodiment of the present application may further include:
[0212] A second correspondence between an event identifier of an event of an event type subscribed by the first client and a subscription identifier of the first client detected during the communication interruption is recorded.
[0213] In order to avoid repeated transmission of the same event, the detection device may generate an event identifier for each event detected by itself, which is used to uniquely identify the event, so as to ensure the global uniqueness of each event by setting an event identifier for each event.
[0214] During the period of communication interruption with the first client, each time the detection device detects an event of the event type subscribed by the first client, it can record the correspondence between the event identifier of the event and the subscription identifier of the first client, thereby obtaining a second correspondence between the event identifier of the event of the event type subscribed by the first client detected during the communication interruption and the subscription identifier of the first client, and recording the second correspondence.
[0215] In this way, the detection device records the second correspondence between the event identifier of each event detected during the communication interruption and the subscription identifier of the client that subscribes to the event type to which the event belongs.
[0216] Accordingly, the above step S103, i.e., the step of sending the target event of the target event type included in the stored events to the second client, may include:
[0217] Send the target event of the target event type included in the stored event and the target event identifier of the target event to the second client; upon receiving a receipt message including the target event identifier and the target subscription identifier sent by the second client, delete the correspondence between the target event identifier and the target subscription identifier in the second correspondence, and / or delete the stored target event.
[0218] When receiving the retransmission request sent by the second client, the detection device can determine the target event type associated with the target subscription identifier of the second client based on the first correspondence between the recorded event type and the subscription identifier, and then send the stored target event of the target event type and the target event identifier of the target event to the second client. Wherein, the detection device sends a complete target event, which may include event content such as event occurrence time and key frames.
[0219] When receiving the target event and the target event identifier sent by the detection device, the second client may send a receipt message including the target event identifier and the target subscription identifier to the detection device.
[0220] If the time elapsed from sending the target event to the second client exceeds the preset receipt reception time, and no receipt message returned by the second client is received within this time, the detection device may send the target event to the second client again until a receipt message sent by the second client is received.
[0221] When the detection device receives a receipt message including a target event identifier and a target subscription identifier sent by the second client, it can determine that the second client has received the target event, and can delete the correspondence between the target event identifier and the target subscription identifier and / or the stored target event in the second correspondence.
[0222] As an implementation mode, when the detection device receives a receipt message including a target event identifier and a target subscription identifier sent by a second client, it can determine that the second client has received the target event and can delete the correspondence between the target event identifier and the target subscription identifier in the second correspondence.
[0223] For example, client X and client Y both subscribe to event type Z. When communication with client X and client Y is interrupted at the same time, the detection device may record event V of event type Z detected during the communication interruption, and respectively establish a second correspondence between event identifier v of event V and subscription identifier x of client X, and between event identifier v of event V and subscription identifier y of client Y. Upon receiving subscription identifier x sent by client X after communication is restored, the detection device may send event V and event identifier v to client X, and upon receiving a receipt message including subscription identifier x and event identifier v returned by client X, delete the correspondence between event identifier v and subscription identifier x.
[0224] As an implementation mode, in the second correspondence, there is only a correspondence between the target event identifier and the target subscription identifier, and there is no correspondence between the target event identifier and other subscription identifiers. When the detection device receives a receipt message including the target event identifier and the target subscription identifier sent by the second client, it can determine that the second client has received the target event, and can delete the correspondence between the target event identifier and the target subscription identifier in the second correspondence, and delete the stored target event.
[0225] As an implementation mode, when the detection device receives a receipt message including a target event identifier and a target subscription identifier sent by each second client, it can determine that the second client has received the target event. After receiving a drawing message sent by a client corresponding to each target subscription identifier that has a corresponding relationship with the target event identifier in the second correspondence, the detection device can delete the stored target event.
[0226] For each target event, the detection device can delete the corresponding relationship between the target event identifier of the target event and the subscription identifier of the client in the second corresponding relationship each time it receives a receipt message sent by the client that includes the target event identifier of the target event and the subscription identifier of the client. That is, after determining that the client has received the target event, the detection device can delete the corresponding relationship between the target event identifier of the target event and the subscription identifier of the client, thereby avoiding repeated transmission of the target event to the client.
[0227] Then, for each target event, when the detection device deletes the second correspondence between the event identifier and the subscription identifier, and the correspondence between the target event identifier of the target event and each subscription identifier, the detection device has continued to transmit the target event to each client of the event type that subscribes to the target event, and each client has received the target event, and there is no omission of the target event. In other words, the detection device has completed the event disconnection and continued transmission of the target event, and can delete the stored target event to release memory space.
[0228] For example, client X and client Y both subscribe to event type Z. When communication with client X and client Y is interrupted at the same time, the detection device may record event V of event type Z detected during the communication interruption, and respectively establish a second correspondence between event identifier v of event V and subscription identifier x of client X, and between event identifier v of event V and subscription identifier y of client Y. Upon receiving subscription identifier x sent by client X after communication is restored, the detection device may send event V and event identifier v to client X, and upon receiving a receipt message including subscription identifier x and event identifier v returned by client X, delete the correspondence between event identifier v and subscription identifier x; upon receiving subscription identifier y sent by client Y after communication is restored, the detection device may send event V and event identifier v to client Y, and upon receiving a receipt message including subscription identifier y and event identifier v returned by client Y, delete the correspondence between event identifier v and subscription identifier y. In this way, when all correspondences of event identifier v of event V are deleted, the event V may be deleted.
[0229] In this embodiment, the detection device can generate an event identifier for each event detected. In this way, the detection device can record the second corresponding relationship between the event identifier of the event type subscribed by the first client and the subscription identifier of the first client detected during the communication interruption. When receiving the retransmission request of the second client, the target event of the target event type and the target event identifier of the target event can be sent to the second client. And in the case of receiving a receipt message including the target event identifier and the target subscription identifier sent by the second client, stop sending the target event to the second client. And from the second corresponding relationship, delete the corresponding relationship between the target event identifier and the target subscription identifier, and / or the stored target event. In this way, by generating an event identifier for each event, the global uniqueness of each event can be guaranteed, and by recording the second corresponding relationship between the event identifier and the subscription identifier of each event detected during the communication interruption, it can be avoided that when the event is disconnected and continued, the event transmission progress can be clarified according to the corresponding relationship between each event identifier and the subscription identifier in the above-mentioned second corresponding relationship, and the event is avoided to be repeatedly transmitted and missed. After receiving the network-resumable event, the client must return a receipt message, and the detection device uses the receipt message as the standard for the successful network-resumable event, thereby ensuring that the network-resumable event is not lost. After the detection device deletes the correspondence between the target event identifier of the target event and each subscription identifier in the second correspondence, the event network-resumable event of the target event has been completed, and the stored target event can be deleted to release the memory space of the detection device.
[0230] As an implementation of an embodiment of the present application, a method for resuming transmission after network disconnection provided in an embodiment of the present application may also include:
[0231] receiving a subscription cancellation request sent by a third client, wherein the subscription cancellation request includes a subscription identifier of the third client, and the third client is at least one of the clients that have subscribed to the event;
[0232] The corresponding relationship between the subscription identifier of the third client and each event type in the recorded first corresponding relationship is deleted, and a cancellation success notification message is sent to the third client.
[0233] For a client that has subscribed to an event of the detection device, when the user wishes to cancel the event subscription, the user may send a cancellation instruction to the third client.
[0234] The third client can send a cancellation request including the subscription identifier of the third client to the detection device based on the user's cancellation instruction. In this way, the detection device can receive the cancellation request sent by the third client, search for the correspondence between the subscription identifier of the third client and each event type in the recorded first correspondence, and delete the correspondence between the subscription identifier of the third client and each event type in the recorded first correspondence.
[0235] After deleting the correspondence between the subscription identifier of the third client and each event type in the first correspondence, the detection device can generate a notification message of successful cancellation and send the notification message to the third client, so that the third client receives the successful cancellation message and displays the successful cancellation message to inform the user that the event subscription has been canceled and will not receive events reported by the detection device in the future.
[0236] Among them, the above-mentioned third client sends a cancellation event subscription message to the detection device, so that the detection device deletes the first correspondence, the process of the correspondence between the subscription identifier of the third client and each event type, that is, the process of the third client instructing the detection device to release the subscription identifier of the third client, that is, the process of the third client actively releasing the subscription identifier.
[0237] In the case where a third client occupies the resuming path of the detection device, when the detection device releases the subscription identifier of the third client, the resuming path in the detection device will also be released. Therefore, by actively releasing the subscription identifier through the client, the resuming path and memory space of the detection device can be released.
[0238] As an implementation method, when the third device wishes to subscribe to an event again, the third device can regenerate a subscription identifier for the detection device, and resend a reading request including the subscription identifier to the detection device. When the detection device receives the reading request including the subscription identifier sent by the third client, it can establish a first correspondence between the event type subscribed by the third client this time and the subscription identifier.
[0239] As an implementation mode, when the third client wishes to cancel the event subscription for some event types, the third client may send a cancellation request including the subscription identifier of the third client and the event types for which the subscription is desired to be cancelled. The detection device may receive the cancellation request, delete the correspondence between the subscription identifier of the third client and the event types for which the subscription is desired to be cancelled in the recorded first correspondence, and send a cancellation success notification message to the third client.
[0240] In this embodiment, the detection device can receive a subscription cancellation request including a subscription identifier of the third client sent by the third client, delete the correspondence between the subscription identifier of the third client and each event type in the recorded first correspondence, and send a cancellation success notification message to the third client. The detection device supports the client to actively release the subscription identifier to release the memory space of the detection device and release the retransmission path allocated to the client.
[0241] As an implementation method of the embodiment of the present application, the subscription identifier has a valid duration;
[0242] The above step S101, i.e. the step of storing events of the event type subscribed by the first client detected during the communication interruption, may include:
[0243] The event of the event type subscribed by the first client, detected by the detection device during the communication interruption and within the validity period of the subscription identifier of the first client, is stored.
[0244] When the client wishes to subscribe to events within a period of time, the client can generate a subscription identifier with a valid duration, and send a subscription request including the subscription identifier to the detection device. The valid duration of the subscription identifier can be the valid duration of the event that the client subscribes to this time, that is, the client only subscribes to events within the valid duration, and the detection device only sends events of the event type corresponding to the subscription identifier detected within the valid duration starting from the receipt of the subscription identifier to the client with the subscription identifier; it can also be that when the communication between the client and the detection device is interrupted, the detection device stores the events of the event type subscribed by the client detected within the valid duration, that is, from the time the detection device detects that the communication with the client is interrupted, only the detection device stores the events of the event type corresponding to the subscription identifier detected within the valid duration, and after the communication is restored, the events detected within the valid duration are sent to the client with the subscription identifier, and the valid duration of the subscription identifier is not limited here.
[0245] When receiving a subscription request from a first client, if the subscription identifier carried in the subscription request has a valid duration, then when the detection device detects that communication with the first client is interrupted, the detection device can store events of the event type subscribed by the first client that are detected during the communication interruption and within the valid duration of the subscription identifier of the first client.
[0246] As an implementation mode, when receiving the subscription request from the first client, the detection device may record the time of receiving the subscription request and the effective duration of the subscription identifier of the first client. After detecting that the communication with the first client is interrupted, the detection device may record the communication interruption time, and based on the recorded time of receiving the subscription request, the effective duration of the subscription identifier and the communication interruption time, calculate the remaining effective duration of the subscription identifier of the first client when the communication is interrupted. If the remaining valid duration of the subscription identifier of the first client is 0 when the communication is interrupted, then the detection device does not need to establish a second correspondence between the events of the event type subscribed by the first client in the events detected during the communication interruption and the subscription identifier of the first client, nor does it need to continue to transmit the events of the event type subscribed by the first client in the events stored during the communication interruption to the first client when the communication is restored; if the remaining valid duration of the subscription identifier of the first client is not 0 when the communication is interrupted, then the detection device can establish a second correspondence between the events of the event type subscribed by the first client detected during the communication interruption and within the remaining valid duration of the subscription identifier of the first client and the subscription identifier of the first client, and when the communication is restored, continue to transmit the events of the event type subscribed by the first client stored during the communication interruption and within the remaining valid duration of the subscription identifier of the first client to the first client.
[0247] As an implementation mode, after detecting that communication with the first client is interrupted, the detection device can store events of the event type subscribed by the first client that are detected within the effective period of the subscription identifier starting from the time of communication interruption, establish a second correspondence between the detected events and the subscription identifier of the first client, and after communication is restored, continue to transmit the events stored within the effective period of the subscription identifier to the first client.
[0248] Correspondingly, when a retransmission request is received from a second client in the first client, events of the event type subscribed by the second client detected during the communication interruption and within the validity period of the subscription identifier of the second client are retransmitted to the second client.
[0249] In this embodiment, the client can generate a subscription identifier with a valid duration. In this way, the detection device performs real-time events related to the client's subscription identifier and event resumption during the valid duration of the subscription identifier. This saves the computing resources consumed by performing event detection on the subscription identifier in time periods outside the valid duration while supporting the client to set the event deployment time by setting the valid duration of the subscription identifier.
[0250] As an implementation method of the embodiment of the present application, at least one client in a security device provided in the embodiment of the present application can communicate with multiple detection devices and subscribe to events of multiple detection devices. When the detection device sends an event to each client, it can also send an identification of the detection device, wherein the identification of the detection device includes at least one of a device identification, an IP address, and port information.
[0251] As an implementation method, Figure 6 As shown, the security system may include at least one client and at least one detection device, that is, the security system may include client 1, client 2 to client n, and detection devices 1, detection device 2 to detection device n. Each client may communicate with at least one detection device and subscribe to events for at least one detection device. When each detection device sends an event to each client, it may also send an identification of the detection device.
[0252] As an implementation method, at least one client in the security system can also communicate with at least one detection device other than the detection device of the security system to obtain event data of different defense areas. A method for resuming transmission after network disconnection provided in an embodiment of the present application is applicable to each detection device, and each detection device can also send an identification mark of the detection device when sending an event to each client.
[0253] When each client subscribes to events of different detection devices, the subscription identifiers in the subscription requests sent to each detection device may be the same or different.
[0254] In order to facilitate the client to distinguish the sending device of the received event, each detection device can also send its own identification identifier when sending real-time events or network disconnection and resumption events to each client, so that when the detection device receives the event sent by the detection device, it can establish a correspondence between the event and the identification identifier of the detection device.
[0255] The identification mark of the detection device may include at least one of the device identification, IP address and port information. Of course, it may also include other information that can be used to uniquely identify the detection device, which is not specifically limited here.
[0256] As an implementation method of the embodiment of the present application, the detection device can simultaneously perform real-time event transmission and event network disconnection and resuming transmission. In order to facilitate the client to distinguish between real-time events and network disconnection and resuming transmission events, the detection device can also set a corresponding transmission category identifier in each event, that is, set a real-time transmission identifier in the real-time event, and set a resuming transmission identifier in the network disconnection and resuming transmission event. In this way, when the client receives an event transmitted by the detection device, it can determine whether the event is a real-time event or a network disconnection and resuming transmission event based on the transmission category identifier included in the event.
[0257] As an implementation method of an embodiment of the present application, when the client contains an event identifier in its own stored event identifier that is consistent with the target event identifier sent by the detection device, the client can send a repeated event notification message to the detection device, so that the detection device receives the repeated event notification message and outputs a retransmission troubleshooting message, so that the target object can perform event retransmission troubleshooting.
[0258] After receiving the event sent by the detection device, the client can store the event identifier of the event to facilitate retransmission and verification of the subsequently received event.
[0259] Furthermore, when the client receives the target event and the target event identifier of the target event sent by the detection device, it can send a receipt message carrying the target event identifier and its own subscription identifier, so that the detection device can determine that the event is successfully retransmitted. In addition, the client can also retransmit and check the target event based on the event identifier stored by itself.
[0260] If it is detected that there is an event identifier consistent with the target event identifier among the event identifiers stored in the detection device, then the detection device repeatedly reports the target event to the client, and the client can send a repeated event notification message to the detection device.
[0261] The detection device can receive the repeated event notification message and output a retransmission fault troubleshooting message to the target object, so that the target object can perform event retransmission fault troubleshooting on the detection device. The target object can be a staff member or an electronic device that performs data maintenance on the detection device.
[0262] In order to facilitate understanding of a method for resuming transmission after disconnection provided by an embodiment of the present application, Figure 7 The signaling interaction process between the client and the detection device is described.
[0263] Among them, the device is the detection device in the embodiment of the present application, and the retransmission ID (Identity Document, identification number) is the subscription identifier in the embodiment of the present application.
[0264] For each client in the security system, when it wants to subscribe to an event, the client can generate a retransmission ID and save the retransmission ID. When the network between the client and the device is normal, the client can send an event subscription request carrying the retransmission ID to the device. The device can receive the event subscription request from the client and return a response message to the client.
[0265] Afterwards, the device may establish a first correspondence between the client's retransmission ID and the event type subscribed by the client. When an event of the event type subscribed by the client is detected, the device may detect the subscription event of the client based on the established first correspondence. When the network is normal, the device may upload the subscription event to the client when a subscription event of the event type subscribed by the client is detected.
[0266] When a network interruption with a client is detected, the device can detect a trigger event of an event type subscribed by the client during the network interruption, store the trigger event, and associate the resume ID to obtain a second correspondence between the trigger event and the resume ID. The device stores the detected trigger event in a storage area of the event type corresponding to the trigger event without duplication, and associates the trigger event with the resume ID of the client.
[0267] When the client detects that the network has been restored, it can resend an event subscription request carrying a resume ID to the device. The device can receive the event subscription request and return a response message. The device can identify the client based on the resume ID in the event subscription request resent by the client, and determine the target event type corresponding to the resume ID based on the resume ID and the first correspondence between the pre-recorded resume ID and the event type, and according to the second correspondence, use the trigger event corresponding to the resume ID in each trigger event included in the target event type as a retransmission event, and then upload the retransmission event, which carries the event unique identifier. The client receives the retransmission event and feeds back a resume confirmation response carrying the event unique identifier and the resume ID. This cycle continues until the device sends all the trigger events recorded during the network interruption to the client, completing the event network interruption and resume transmission of the client.
[0268] The client can send a subscription cancellation request including a retransmission ID to the device to release the retransmission ID. When the device receives the subscription cancellation request sent by the client, it can delete the first correspondence between the client's retransmission ID and the event type subscribed by the client, and return response information to the client.
[0269] Corresponding to the above-mentioned network-disconnected transmission resuming method applied to the detection device in the security inspection system, the present embodiment also provides a network-disconnected transmission resuming method applied to a target client in at least one client in the security inspection system.
[0270] like Figure 8 As shown, a method for resuming transmission after disconnection is applied to a target client in at least one client in a security system, wherein the security system further includes a detection device, and the at least one client communicates with the detection device; the method includes:
[0271] S801: When it is detected that the communication with the detection device is restored, a retransmission request including the target subscription identifier of the target client is sent to the detection device, so that the detection device determines the target event type corresponding to the target subscription identifier based on the target subscription identifier and a first correspondence between the pre-recorded event type and the subscription identifier.
[0272] S802: Receive a target event of the target event type included in the events stored in the detection device and sent by the detection device.
[0273] The target event is an event of a target event type subscribed by the target client that is detected during the communication interruption and stored by the detection device after the detection device detects that the communication with the target client is interrupted.
[0274] In the solution provided by the embodiment of the present application, the security system may include a detection device and at least one client communicating with the detection device. After detecting that the communication with the first client is interrupted, the detection device may store the event of the event type subscribed by the first client detected during the communication interruption, wherein the first client is at least one of the clients; receive a retransmission request sent by the second client, and determine the target event type corresponding to the target subscription identifier based on the target subscription identifier included in the retransmission request and the first correspondence between the pre-recorded event type and the subscription identifier, wherein the second client is at least one of the first clients, and the retransmission request is sent by the second client after the communication is restored; and then send the target event of the target event type included in the stored event to the second client.
[0275] Since the subscription identifiers sent by each client to the detection device are consistent before and after the communication interruption, and the subscription identifier will not change with the device update of the client, the change of the communication environment of the client, etc., the detection device can accurately identify the client based on the subscription identifiers of each client stored by itself and the subscription identifiers sent by the client after the communication is restored, and continue to transmit the events recorded during the communication interruption to the client, thus realizing the event interruption and transmission of the client. In addition, since the first corresponding relationship between the event type and the subscription identifier is established in advance, the detection device only needs to store the events detected during the communication interruption according to the event type once, which saves the storage space of the detection device compared to the storage method of storing the events detected during the communication interruption for each client separately.
[0276] As an implementation manner of an embodiment of the present application, before the step of sending a resume request including a target subscription identifier of the target client to the detection device when detecting that the communication with the detection device is restored, the method further includes:
[0277] A subscription request is sent to the detection device, wherein the subscription request includes a target subscription identifier of the target client and an event type of the event to be subscribed, and the target subscription identifier is an identifier generated by the target client for uniquely identifying the target client, so that the detection device receives the subscription request and associates the event type with the target subscription identifier of the target client that has subscribed to the event type, thereby obtaining a first corresponding relationship between the event type and the target subscription identifier of the target client.
[0278] As an implementation manner of the embodiment of the present application, before the step of sending a subscription request to the detection device, the method further includes:
[0279] Sending a subscription identification range acquisition instruction to the detection device;
[0280] Receiving a range of subscription identifiers supported by the detection device, wherein the range of subscription identifiers is sent by the detection device when receiving the subscription identifier range acquisition instruction;
[0281] Within the range, a subscription identifier adapted to the detection device is generated.
[0282] As an implementation method of the embodiment of the present application, each event has an event identifier for uniquely identifying the event;
[0283] The step of receiving a target event of the target event type included in the events stored by the detection device itself and sent by the detection device comprises:
[0284] receiving a target event of the target event type and a target event identifier of the target event included in the events stored in the detection device and sent by the detection device;
[0285] A receipt message including the target event identifier and the target subscription identifier is sent to the detection device, so that the detection device stops sending the target event when receiving the receipt message, and deletes the corresponding relationship between the target event identifier and the target subscription identifier in a second corresponding relationship, and / or deletes the stored target event, wherein the second corresponding relationship is the corresponding relationship between the event identifier of the event type subscribed by the target client detected during the communication interruption recorded by the detection device and the target subscription identifier.
[0286] As an implementation of the embodiment of the present application, the method further includes:
[0287] Sending a subscription cancellation request including the target subscription identifier to the detection device, so that the detection device deletes the correspondence between the target subscription identifier and each event type in the first correspondence recorded;
[0288] Receive a cancellation success notification message sent by the detection device.
[0289] As an implementation of the embodiment of the present application, the method further includes:
[0290] When there is an event identifier consistent with the target event identifier in the event identifier stored in itself, a repeated event notification message is sent to the detection device so that the detection device receives the repeated event notification message and outputs a retransmission troubleshooting message so that the target object can perform event retransmission troubleshooting.
[0291] After receiving the event sent by the detection device, the target client can store the event identifier of the event to facilitate retransmission and verification of the subsequently received event.
[0292] Furthermore, when the target client receives the target event and the target event identifier of the target event sent by the detection device, it can send a receipt message carrying the target event identifier and its own subscription identifier, so that the detection device can determine that the event transmission is successful. In addition, the target client can also retransmit and verify the target event based on the event identifier stored by itself.
[0293] If it is detected that there is an event identifier consistent with the target event identifier among the event identifiers stored in itself, then the detection device repeatedly reports the target event to the target client, and the target client can send a repeated event notification message to the detection device.
[0294] The detection device can receive the repeated event notification message and output a retransmission fault troubleshooting message to the target object, so that the target object can perform event retransmission fault troubleshooting on the detection device. The target object can be a staff member or an electronic device that performs data maintenance on the detection device.
[0295] The other steps in the method are consistent with the implementation of the above-mentioned method for resuming transmission after network disconnection applied to the detection equipment in the security inspection system, and will not be repeated here.
[0296] Corresponding to the above-mentioned network-disconnection resuming transmission method for detection equipment applied to a security system, an embodiment of the present application also provides a network-disconnection resuming transmission device for detection equipment applied to a security system. The following is an introduction to the network-disconnection resuming transmission device for detection equipment applied to a security system provided by an embodiment of the present application. The security system also includes at least one client that communicates with the detection equipment.
[0297] like Fig. 9 As shown, a device for resuming transmission after network disconnection of an event comprises:
[0298] A storage module 910 is used to store, after detecting a communication interruption with a first client, an event of an event type subscribed to by the first client detected during the communication interruption, wherein the first client is at least one of the clients;
[0299] A resume request receiving module 920 is used to receive a resume request sent by a second client, and determine a target event type corresponding to the target subscription identifier based on a target subscription identifier included in the resume request and a first correspondence between a pre-recorded event type and a subscription identifier, wherein the second client is at least one of the first clients, and the resume request is sent by the second client after communication is restored;
[0300] The event sending module 930 is used to send the target event of the target event type included in the stored events to the second client.
[0301] In the solution provided by the embodiment of the present application, the security system may include a detection device and at least one client communicating with the detection device. After detecting that the communication with the first client is interrupted, the detection device may store the event of the event type subscribed by the first client detected during the communication interruption, wherein the first client is at least one of the clients; receive a retransmission request sent by the second client, and determine the target event type corresponding to the target subscription identifier based on the target subscription identifier included in the retransmission request and the first correspondence between the pre-recorded event type and the subscription identifier, wherein the second client is at least one of the first clients, and the retransmission request is sent by the second client after the communication is restored; and then send the target event of the target event type included in the stored event to the second client.
[0302] Since the subscription identifiers sent by each client to the detection device are consistent before and after the communication interruption, and the subscription identifier will not change with the device update of the client, the change of the communication environment of the client, etc., the detection device can accurately identify the client based on the subscription identifiers of each client stored by itself and the subscription identifiers sent by the client after the communication is restored, and continue to transmit the events recorded during the communication interruption to the client, thus realizing the event interruption and transmission of the client. In addition, since the first corresponding relationship between the event type and the subscription identifier is established in advance, the detection device only needs to store the events detected during the communication interruption according to the event type once, which saves the storage space of the detection device compared to the storage method of storing the events detected during the communication interruption for each client separately.
[0303] As an implementation of the embodiment of the present application, the device further includes:
[0304] A subscription request receiving module, used for receiving a subscription request sent by each client before the step of storing events of the event type subscribed by the first client detected during the communication interruption after the communication interruption with the first client is detected, wherein the subscription request includes a subscription identifier of the client and an event type of the event to be subscribed, and the subscription identifier is an identifier generated by the client for uniquely identifying the client;
[0305] The association module is used to associate the event type with the subscription identification of each client that subscribes to the event type, so as to obtain a first corresponding relationship between the event type and the subscription identification of each client.
[0306] As an implementation of the embodiment of the present application, the device further includes:
[0307] The range sending module is used to send the range of subscription identifiers supported by itself to the client before the step of receiving the subscription request sent by each client, when receiving the subscription identifier range acquisition instruction sent by each client, so that the client can generate a subscription identifier suitable for the detection device within the range.
[0308] As an implementation method of the embodiment of the present application, the detection device supports storing events corresponding to the retransmission paths of the preset retransmission paths at the same time, and each client corresponds to a retransmission path;
[0309] The device also includes:
[0310] A client determination module, configured to determine the client to be cancelled from the clients to which the retransmission path has been allocated based on the preset priority of each client after the step of receiving the subscription request sent by each client, if the current retransmission path reaches the preset number of retransmission paths;
[0311] The release module is used to release the retransmission path corresponding to the client to be cancelled, and allocate the released retransmission path to the client that sends the subscription request.
[0312] As an implementation method of the embodiment of the present application, the detection device stores events of each event type without duplication;
[0313] The storage module 910 includes:
[0314] a storage submodule, configured to, after detecting that communication with a first client is interrupted, store each event of an event type subscribed by the first client detected during the communication interruption only once, wherein the first client includes a plurality of clients;
[0315] The event sending module 930 includes:
[0316] The event sending submodule is used to send the target event of the target event type included in each event stored only once to each second client.
[0317] As an implementation method of the embodiment of the present application, each event has an event identifier for uniquely identifying the event;
[0318] The device also includes:
[0319] a second correspondence recording module, configured to record, before the step of receiving the resume request sent by the second client, a second correspondence between an event identifier of an event of an event type subscribed by the first client detected during the communication interruption and a subscription identifier of the first client;
[0320] The event sending module 930 includes:
[0321] an identification sending unit, configured to send a target event of the target event type included in the stored events and a target event identification of the target event to the second client;
[0322] A stopping unit is used to delete the correspondence between the target event identifier and the target subscription identifier in the second corresponding relationship, and / or delete the stored target event when receiving a receipt message including the target event identifier and the target subscription identifier sent by the second client.
[0323] As an implementation of the embodiment of the present application, the device further includes:
[0324] A subscription cancellation request receiving module, configured to receive a subscription cancellation request sent by a third client, wherein the subscription cancellation request includes a subscription identifier of the third client, and the third client is at least one of the clients that have subscribed to the event;
[0325] The first correspondence deletion module is used to delete the correspondence between the subscription identifier of the third client and each event type in the recorded first correspondence, and send a cancellation success notification message to the third client.
[0326] As an implementation method of the embodiment of the present application, the subscription identifier has a valid duration;
[0327] The storage module 910 includes:
[0328] The storage unit is used to store events of the event type subscribed by the first client detected by the detection device during the communication interruption and within the validity period of the subscription identifier of the first client.
[0329] As an implementation example of the present application, the target subscription identifier is the same as the subscription identifier used by the second client when communication is normal, or the target subscription identifier is different from the subscription identifier used by the second client when communication is normal, wherein the subscription identifier used when communication is normal is the subscription identifier used to send subscription events to the second client in real time when communication with the second client is normal.
[0330] Corresponding to the above-mentioned method for resuming transmission after network disconnection for a target client in at least one client in a security system, an embodiment of the present application also provides a device for resuming transmission after network disconnection for a target client in at least one client in a security system. The following is an introduction to the device for resuming transmission after network disconnection for a target client in at least one client in a security system provided in an embodiment of the present application. The security system also includes a detection device, which communicates with the at least one client.
[0331] like Fig.10 As shown, a network-disconnected transmission resuming device comprises:
[0332] A retransmission request sending module 1010 is used to send a retransmission request including a target subscription identifier of a target client to the detection device when it is detected that the communication with the detection device is restored, so that the detection device determines the target event type corresponding to the target subscription identifier based on the target subscription identifier and the first correspondence between the event type and the subscription identifier recorded in advance;
[0333] The event receiving module 1020 is used to receive a target event of the target event type included in the event stored by the detection device itself and sent by the detection device, wherein the target event is an event of the target event type subscribed by the target client detected during the communication interruption period stored after the detection device detects that the communication with the target client is interrupted.
[0334] In the solution provided by the embodiment of the present application, the security system may include a detection device and at least one client communicating with the detection device. After detecting that the communication with the first client is interrupted, the detection device may store the event of the event type subscribed by the first client detected during the communication interruption, wherein the first client is at least one of the clients; receive a retransmission request sent by the second client, and determine the target event type corresponding to the target subscription identifier based on the target subscription identifier included in the retransmission request and the first correspondence between the pre-recorded event type and the subscription identifier, wherein the second client is at least one of the first clients, and the retransmission request is sent by the second client after the communication is restored; and then send the target event of the target event type included in the stored event to the second client.
[0335] Since the subscription identifiers sent by each client to the detection device are consistent before and after the communication interruption, and the subscription identifier will not change with the device update of the client, the change of the communication environment of the client, etc., the detection device can accurately identify the client based on the subscription identifiers of each client stored by itself and the subscription identifiers sent by the client after the communication is restored, and continue to transmit the events recorded during the communication interruption to the client, thus realizing the event interruption and transmission of the client. In addition, since the first corresponding relationship between the event type and the subscription identifier is established in advance, the detection device only needs to store the events detected during the communication interruption according to the event type once, which saves the storage space of the detection device compared to the storage method of storing the events detected during the communication interruption for each client separately.
[0336] As an implementation of the embodiment of the present application, the device further includes:
[0337] A subscription request sending module, used for sending a subscription request to the detection device before the step of sending a retransmission request including a target subscription identifier of the target client to the detection device when it is detected that the communication with the detection device is restored, wherein the subscription request includes the target subscription identifier of the target client and the event type of the event to be subscribed, and the target subscription identifier is an identifier generated by the target client for uniquely identifying the target client, so that the detection device receives the subscription request and associates the event type with the target subscription identifier of the target client that has subscribed to the event type, thereby obtaining a first corresponding relationship between the event type and the target subscription identifier of the target client.
[0338] As an implementation of the embodiment of the present application, the device further includes:
[0339] An acquisition instruction sending module, used for sending a subscription identifier range acquisition instruction to the detection device before the step of sending a subscription request to the detection device;
[0340] A range receiving module, used to receive a range of subscription identifiers supported by the detection device, wherein the range of subscription identifiers is sent by the detection device when receiving the subscription identifier range acquisition instruction;
[0341] The identification generation module is used to generate a subscription identification suitable for the detection device within the range.
[0342] As an implementation method of the embodiment of the present application, each event has an event identifier for uniquely identifying the event;
[0343] The event receiving module 1020 includes:
[0344] an identification receiving unit, configured to receive a target event of the target event type and a target event identification of the target event included in the events stored in the detection device itself and sent by the detection device;
[0345] A receipt message sending unit is used to send a receipt message including the target event identifier and the target subscription identifier to the detection device, so that the detection device stops sending the target event when receiving the receipt message, and deletes the correspondence between the target event identifier and the target subscription identifier in the second correspondence, and / or deletes the stored target event, wherein the second correspondence is the correspondence between the event identifier of the event type subscribed by the target client detected during the communication interruption recorded by the detection device and the target subscription identifier.
[0346] As an implementation of the embodiment of the present application, the device further includes:
[0347] a subscription cancellation request sending module, configured to send a subscription cancellation request including the target subscription identifier to the detection device, so that the detection device deletes the correspondence between the target subscription identifier and each event type in the first correspondence recorded;
[0348] The notification message receiving module is used to receive the cancellation success notification message sent by the detection device.
[0349] As an implementation of the embodiment of the present application, the device further includes:
[0350] The troubleshooting module is used to send a repeated event notification message to the detection device when there is an event identifier consistent with the target event identifier in the event identifier stored in itself, so that the detection device receives the repeated event notification message, and output a retransmission fault troubleshooting message so that the target object can perform event retransmission fault troubleshooting.
[0351] The present application also provides a security system, such as Figure 2 As shown, the security system includes a detection device 100 and at least one client 200, and the detection device 100 communicates with the at least one client 200.
[0352] The detection device 100 is used to implement a method for resuming transmission after network disconnection for a detection device in a security system;
[0353] The target client 200 in the at least one client is used to implement a method for resuming transmission after network disconnection for a target client in the at least one client in a security system.
[0354] In the solution provided by the embodiment of the present application, the security system may include a detection device and at least one client communicating with the detection device. After detecting that the communication with the first client is interrupted, the detection device may store the event of the event type subscribed by the first client detected during the communication interruption, wherein the first client is at least one of the clients; receive a retransmission request sent by the second client, and determine the target event type corresponding to the target subscription identifier based on the target subscription identifier included in the retransmission request and the first correspondence between the pre-recorded event type and the subscription identifier, wherein the second client is at least one of the first clients, and the retransmission request is sent by the second client after the communication is restored; and then send the target event of the target event type included in the stored event to the second client.
[0355] Since the subscription identifiers sent by each client to the detection device are consistent before and after the communication interruption, and the subscription identifier will not change with the device update of the client, the change of the communication environment of the client, etc., the detection device can accurately identify the client based on the subscription identifiers of each client stored by itself and the subscription identifiers sent by the client after the communication is restored, and continue to transmit the events recorded during the communication interruption to the client, thus realizing the event interruption and transmission of the client. In addition, since the first corresponding relationship between the event type and the subscription identifier is established in advance, the detection device only needs to store the events detected during the communication interruption according to the event type once, which saves the storage space of the detection device compared to the storage method of storing the events detected during the communication interruption for each client separately.
[0356] The present application also provides a detection device, such as Fig.11 As shown, including:
[0357] Memory 1101, used for storing computer programs;
[0358] The processor 1102 is used to implement the network disconnection and resuming transmission method for the detection equipment in the security system when executing the program stored in the memory 1101.
[0359] Furthermore, the detection device may further include a communication bus and / or a communication interface, and the processor 1102, the communication interface, and the memory 1101 communicate with each other via the communication bus.
[0360] The present application embodiment also provides a client, such as Fig.12 As shown, including:
[0361] Memory 1201, used for storing computer programs;
[0362] The processor 1202 is used to implement a method for resuming network transmission applied to a target client in at least one client in the security system when executing the program stored in the memory 1201.
[0363] In addition, the client may further include a communication bus and / or a communication interface, and the processor 1202, the communication interface, and the memory 1201 communicate with each other via the communication bus.
[0364] The communication bus can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0365] The communication interface is used for communication between the above electronic device and other devices.
[0366] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0367] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0368] In another embodiment provided in the present application, a computer-readable storage medium is also provided, which stores a computer program. When the computer program is executed by a processor, it implements any of the above-mentioned steps for implementing the network-resuming transmission method for a detection device applied to a security system, or the network-resuming transmission method for a target client in at least one client in the security system.
[0369] In another embodiment provided by the present application, a computer program product comprising instructions is also provided. When the computer is run on a computer, the computer executes any one of the above embodiments for implementing the network-resuming transmission method applied to a detection device in a security system, or the network-resuming transmission method applied to a target client in at least one client in the security system.
[0370] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a solid-state hard disk (SSD), etc.
[0371] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0372] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device, system, detection equipment, client, computer-readable storage medium, and computer program product embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.
[0373] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application are included in the protection scope of the present application.
Claims
1. A method for resuming transmission after network disconnection. It is characterized in that A detection device applied to a security system, wherein the security system further comprises at least one client communicating with the detection device; the method comprises: After detecting a communication interruption with a first client, storing events of an event type subscribed to by the first client detected during the communication interruption, wherein the first client is at least one of the clients, and the detection device stores events of each event type without duplication; Receive a resume request sent by a second client, and determine a target event type corresponding to the target subscription identifier based on a target subscription identifier included in the resume request and a first correspondence between an event type and a subscription identifier recorded in advance, wherein the second client is at least one of the first clients, the resume request is sent by the second client after communication is restored, and the subscription identifier is an identifier generated by the client for uniquely identifying the client; Sending a target event of the target event type included in the stored events to the second client.
2. The method according to claim 1, It is characterized in that Before the step of storing events of an event type subscribed by the first client detected during the communication interruption after detecting the communication interruption with the first client, the method further includes: Receiving a subscription request sent by each client, wherein the subscription request includes a subscription identifier of the client and an event type of an event to be subscribed; The event type is associated with the subscription identifier of each client that has subscribed to the event type, so as to obtain a first corresponding relationship between the event type and the subscription identifier of each client.
3. The method according to claim 2, It is characterized in that Before the step of receiving the subscription request sent by each client, the method further includes: When receiving the subscription identifier range acquisition instruction sent by each client, the range of subscription identifiers supported by the client is sent to the client, so that the client generates a subscription identifier suitable for the detection device within the range.
4. The method according to claim 2, It is characterized in that The detection device supports storing events corresponding to the retransmission paths with a preset number of retransmission paths at the same time, and each client corresponds to a retransmission path; After the step of receiving the subscription request sent by each client, the method further includes: If the current resuming path reaches the preset number of resuming paths, based on the preset priorities of the clients, determining the client to be cancelled from the clients to which the resuming path has been allocated; The resuming path corresponding to the client to be cancelled is released, and the released resuming path is allocated to the client that sends the subscription request.
5. The method according to claim 1, It is characterized in that The step of storing events of an event type subscribed by the first client detected during the communication interruption after the communication interruption with the first client is detected includes: After detecting that communication with a first client is interrupted, for each event of an event type subscribed by the first client detected during the communication interruption, the event is stored only once, wherein the first client includes a plurality of clients; The step of sending the target event of the target event type included in the stored events to the second client comprises: The target event of the target event type included in each event stored only once is sent to each second client respectively.
6. The method according to claim 1, It is characterized in that Each event has an event identifier for uniquely identifying the event; Before the step of receiving the resume request sent by the second client, the method further includes: Recording a second correspondence between an event identifier of an event of an event type subscribed by the first client detected during the communication interruption and a subscription identifier of the first client; The step of sending the target event of the target event type included in the stored events to the second client comprises: Sending a target event of the target event type and a target event identifier of the target event included in the stored events to the second client; When receiving a receipt message including the target event identifier and the target subscription identifier sent by the second client, the corresponding relationship between the target event identifier and the target subscription identifier in the second corresponding relationship is deleted, and / or the stored target event is deleted.
7. The method according to any one of claims 1 to 6, It is characterized in that The method further comprises: receiving a subscription cancellation request sent by a third client, wherein the subscription cancellation request includes a subscription identifier of the third client, and the third client is at least one of the clients that have subscribed to the event; The corresponding relationship between the subscription identifier of the third client and each event type in the first corresponding relationship is deleted, and a cancellation success notification message is sent to the third client.
8. The method according to any one of claims 1 to 6, It is characterized in that The subscription identifier has a validity period; The step of storing events of an event type subscribed by the first client detected during the communication interruption includes: The detection device detects the An event of the event type to which the first client subscribes.
9. The method according to any one of claims 1 to 6, It is characterized in that The target subscription identifier is the same as the subscription identifier used by the second client when communication is normal, or the target subscription identifier is different from the subscription identifier used by the second client when communication is normal, wherein the subscription identifier used when communication is normal is the subscription identifier used to send subscription events to the second client in real time when communication with the second client is normal.
10. A method for resuming transmission after network disconnection. It is characterized in that The method is applied to a target client in at least one client in a security system, wherein the security system further comprises a detection device, and the at least one client communicates with the detection device; the method comprises: When it is detected that the communication with the detection device is restored, a retransmission request including a target subscription identifier of the target client is sent to the detection device, so that the detection device determines the target event type corresponding to the target subscription identifier based on the target subscription identifier and a first correspondence between the event type and the subscription identifier recorded in advance, wherein the target subscription identifier is an identifier generated by the target client for uniquely identifying the target client; Receive a target event of the target event type included in the events stored by the detection device itself and sent by the detection device, wherein the target event is an event of the target event type subscribed to by the target client detected during the stored communication interruption period after the detection device detects that the communication with the target client is interrupted, and the detection device stores events of each event type without duplication.
11. The method according to claim 10, It is characterized in that Before the step of sending a resume request including a target subscription identifier of the target client to the detection device when detecting that the communication with the detection device is restored, the method further includes: A subscription request is sent to the detection device, wherein the subscription request includes a target subscription identifier of the target client and an event type of the event to be subscribed, so that the detection device receives the subscription request and associates the event type with the target subscription identifier of the target client that has subscribed to the event type, thereby obtaining a first corresponding relationship between the event type and the target subscription identifier of the target client.
12. The method according to claim 11, It is characterized in that Before the step of sending a subscription request to the detection device, the method further includes: Sending a subscription identification range acquisition instruction to the detection device; Receiving a range of subscription identifiers supported by the detection device, wherein the range of subscription identifiers is sent by the detection device when receiving the subscription identifier range acquisition instruction; A subscription identifier adapted to the detection device is generated within the range.
13. The method according to claim 10, It is characterized in that Each event has a unique identifier for that event. Event ID; The step of receiving a target event of the target event type included in the events stored by the detection device itself and sent by the detection device comprises: receiving a target event of the target event type and a target event identifier of the target event included in the events stored in the detection device and sent by the detection device; A receipt message including the target event identifier and the target subscription identifier is sent to the detection device, so that the detection device stops sending the target event when receiving the receipt message, and deletes the correspondence between the target event identifier and the target subscription identifier in the second correspondence, and / or deletes the stored target event, wherein the second correspondence is the correspondence between the event identifier of the event type subscribed by the target client detected during the communication interruption recorded by the detection device and the target subscription identifier.
14. The method according to any one of claims 10 to 13, It is characterized in that The method further comprises: Sending a subscription cancellation request including the target subscription identifier to the detection device, so that the detection device deletes the correspondence between the target subscription identifier and each event type in the first correspondence recorded; Receive a cancellation success notification message sent by the detection device.
15. The method according to claim 13, It is characterized in that The method further comprises: When there is an event identifier consistent with the target event identifier in the event identifier stored in itself, a repeated event notification message is sent to the detection device so that the detection device receives the repeated event notification message and outputs a retransmission troubleshooting message so that the target object can perform event retransmission troubleshooting.
16. A device for resuming transmission after network disconnection, It is characterized in that A detection device applied to a security system, wherein the security system further comprises at least one client communicating with the detection device; the device comprises: a storage module, configured to store, after detecting a communication interruption with a first client, events of an event type subscribed to by the first client detected during the communication interruption, wherein the first client is at least one of the clients, and the detection device stores events of each event type without duplication; a resume request receiving module, configured to receive a resume request sent by a second client, and determine a target event type corresponding to the target subscription identifier based on a target subscription identifier included in the resume request and a first correspondence between a pre-recorded event type and a subscription identifier, wherein the second client is at least one of the first clients, the resume request is sent by the second client after communication is restored, and the subscription identifier is an identifier generated by the client for uniquely identifying the client; An event sending module is used to send a target event of the target event type included in the stored events to the second client.
17. A device for resuming transmission after network disconnection, It is characterized in that Applied to a target in at least one client in a security system The security system further comprises a detection device, and the at least one client communicates with the detection device; the apparatus comprises: a resuming request sending module, configured to send a resuming request including a target subscription identifier of the target client to the detection device when detecting that the communication with the detection device is restored, so that the detection device determines the target event type corresponding to the target subscription identifier based on the target subscription identifier and a first correspondence between the event type and the subscription identifier recorded in advance, wherein the target subscription identifier is an identifier generated by the target client for uniquely identifying the target client; An event receiving module is used to receive a target event of the target event type included in the events stored by the detection device itself and sent by the detection device, wherein the target event is an event of the target event type subscribed by the target client detected during the communication interruption period stored by the detection device after the detection device detects that the communication with the target client is interrupted, and the detection device stores events of each event type without duplication.
18. A security system, It is characterized in that The system includes a target client and a detection device in at least one client, wherein the at least one client communicates with the detection device; The detection device is used to implement the method described in any one of claims 1 to 9; The target client is used to implement the method described in any one of claims 10-15.
19. A detection device, It is characterized in that include: Memory, used to store computer programs; A processor, for implementing any of the methods described in claims 1-9 when executing a program stored in a memory.
20. A client, It is characterized in that include: Memory, used to store computer programs; A processor, for implementing any of the methods described in claims 10-15 when executing a program stored in a memory.
21. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method described in any one of claims 1-9 or 10-15 is implemented.
Citation Information
Patent Citations
Method and device for transporting message
CN106130882A
Redis-based multi-user publishing and subscribing method and system
CN107592351A
Message distribution method and device, server and storage medium
CN108390933A
Message event distribution method, distribution platform, system and server
CN111866191A
Game event transmission method and device, equipment and storage medium
CN117018599A
