Access method and system of electronic device, cloud server
By identifying and handling the migration window of node servers in the distributed terminal management system through a proxy server, and establishing a temporary takeover channel, the communication interruption problem caused by regional inconsistency was resolved, and the business continuity and stability of the equipment during the migration period were achieved.
Patent Information
- Application Number
- CN202611089393.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-22
- Publication Date
- 2026-11-27
AI Technical Summary
In a distributed terminal management system, the target access area may not match the actual access area due to factors such as unreleased long connections, cache lag, or network switching delays, leading to communication path breaks and the inability of terminal devices to function properly.
By connecting multiple node servers through a proxy server, the target node server and the current actual node server of the electronic device are obtained, the migration window period is identified, and a temporary proxy takeover channel is established during this period to achieve transparent forwarding of uplink and downlink information and avoid the device from sensing changes in access location.
During the migration window, normal business communication of electronic devices is maintained to avoid communication path interruption and ensure the business continuity and stability of terminal devices without requiring devices to actively reconnect or restart.
Smart Images

Figure CN123185244A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of communication technology, and in particular to an access method and system for electronic devices, and a cloud server. Background Technology
[0002] As the distributed terminal management system evolves from a single-region centralized architecture to a multi-region distributed architecture, the system uses a configuration distribution mechanism to assign target access regions to devices to achieve business migration.
[0003] Due to factors such as unreleased long connections, cache lag, or network switching delays, terminal devices often experience discrepancies between the target access area and the actual access area. This creates a migration window period where messages cannot be accurately delivered to the target business system, resulting in communication path breaks and rendering the terminal device unusable. Summary of the Invention
[0004] The technical problem to be solved by the present invention is to provide an access method and system for electronic devices and a cloud server, which improves the continuity and stability of business communication between electronic devices and node servers during the migration window period.
[0005] To solve the above-mentioned technical problems, the present invention adopts the following technical solution: A method for accessing electronic devices is applied to a proxy server, wherein the proxy server is connected to multiple node servers, and the proxy server is also connected to electronic devices. The multiple node servers are connected to electronic devices of corresponding nodes. The method includes: Obtain the target node server and the current actual node server of the electronic device; The current state of the electronic device is determined based on the target node server and the current actual node server; If the status is a migration window period, a temporary proxy takeover channel is established. Under the temporary proxy takeover channel, the device uplink information of the current actual node server is received and forwarded to the target node server; or the service information sent by the target node server is received and forwarded to the actual node server to realize the access of the electronic device.
[0006] To solve the above-mentioned technical problems, another technical solution adopted by the present invention is as follows: An access system for electronic devices, the system comprising: a main server, a proxy server, electronic devices, a first node server, and a second node server; The main server is used to send target node server configuration information to the electronic device; A proxy server is used to execute the aforementioned access method for an electronic device. An electronic device is used to establish a communication connection with the current actual node server, receive the target node server configuration information sent by the main server, obtain the target node server from the target node server configuration information, and perform a switch from the current actual node server to the target node server. The first node server is used as the current actual node server of the electronic device, establishes a communication connection with the electronic device, receives the device uplink information sent by the electronic device, and receives the business information forwarded by the proxy server and sends it to the electronic device. The second node server is used as the target node server of the electronic device, to receive the uplink information of the device forwarded by the proxy server, and to send service information for the electronic device to the proxy server.
[0007] To solve the above-mentioned technical problems, another technical solution adopted by the present invention is as follows: A cloud server, characterized in that it comprises: A memory configured to store an executable program; and a processor configured to execute the program to perform the access method of an electronic device.
[0008] The beneficial effects of this invention are as follows: By connecting multiple node servers and electronic devices through a proxy server, the proxy server obtains the target node server and the current actual node server of the electronic device, and then determines whether the electronic device is in a migration window based on the comparison results between the target node server and the current actual node server. It can accurately identify the transitional state where the node server configuration has been updated but the physical connection has not yet been switched to the target node server, thereby identifying situations where the target access area and the actual access area of the electronic device are inconsistent, thus avoiding misjudgment that the device has gone offline or switched during this migration window. When it is determined to be a migration window, a temporary proxy takeover channel is established. By receiving the device uplink information from the current actual node server and forwarding it to the target node server, and receiving the business information sent by the target node server and forwarding it to the current actual node server, bidirectional transparent forwarding of uplink and downlink communication is realized during the migration window. This allows the electronic device to maintain normal business communication without being aware of changes in its access location or without actively reconnecting or restarting. This solves the problem that communication path breaks are caused by messages not being accurately delivered to the target business system during the migration window, resulting in the terminal device being unable to be used normally. Attached Figure Description
[0009] Figure 1 A flowchart illustrating the steps of an electronic device access method provided in an embodiment of the present invention; Figure 2 A timing diagram illustrating cross-regional migration of a device access method provided in an embodiment of the present invention; Figure 3 Another step of an access method for an electronic device provided in an embodiment of the present invention is shown in the flowchart. Figure 4 This is a structural diagram of an access system for an electronic device provided in an embodiment of the present invention; Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0010] To make the technical problems, technical solutions, and beneficial effects to be solved by this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and are not intended to limit the scope of this application.
[0011] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this application with unnecessary detail.
[0012] It should be understood that, when used in this application specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or a collection thereof.
[0013] References to "one embodiment" or "some embodiments" as described in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.
[0014] In related technologies, with the large-scale development of distributed POS (Point of Sale) terminal management systems, their deployment architecture is inevitably evolving from a single-region centralized model to a multi-region distributed model. In the initial stage, to balance management convenience and deployment efficiency, all POS terminals typically connect to a single-region (e.g., Asia) MQTT (Message Queuing Telemetry Transport) cluster and business processing system. As the business footprint expands, to achieve low-latency access, increased system capacity, and high availability, new regional nodes in Europe (EU, European Union) and the Americas (US, United States) have been deployed successively.
[0015] During this evolution, devices acquire target access areas and attempt to switch through configuration distribution mechanisms such as Alloc (Allocation, a configuration distribution system). However, due to factors such as the persistence of MQTT / TCP (Transmission Control Protocol) long connections, DNS caching lag, uncontrollable network switching timing, and differences in terminal firmware, a technical contradiction often arises where "the configuration has been updated but the actual connection has not switched." Specifically, the device may have been allocated to the EU area in Alloc, but due to the long connection not being released or reconnection failure, it may still be physically connected to the Asia area, thus creating a migration window period where "the target area node and the actual access area node are inconsistent."
[0016] This deviation between the connection state and the configuration state can cause the following problems: Communication path disruption: Messages cannot be accurately delivered to the target area's business system, resulting in authorization and transaction anomalies; System status disorder: The business platform is unable to accurately perceive the actual reachable path of the device, and the synchronization of online and offline status fails; Soaring resource overhead: To solve the reachability problem, existing technologies have to rely on MQTT Bridge or full cross-domain routing, generating a large amount of redundant traffic.
[0017] Therefore, there is an urgent need for a cross-regional consistency compensation mechanism for migration windows to solve the problem of communication inconsistencies caused by lagging connection state configuration during the multi-regional evolution of distributed POS systems, which leads to the inability of terminal devices to function properly.
[0018] To address the aforementioned problems, this application provides a method and system for accessing electronic devices, as well as a cloud server. The following details the method for accessing electronic devices according to this application.
[0019] The access method for electronic devices in this application can be used in a distributed terminal management system, and is particularly suitable for application environments where terminal devices migrate and access between nodes in different regions in cross-regional deployment scenarios. The electronic devices in this application can be various intelligent terminal devices that maintain long-term communication with the access cluster via the MQTT protocol, such as POS terminal devices, self-service checkout terminals, payment terminals, and sales terminals.
[0020] The following details the access method for electronic devices in this invention, applied to a proxy server. The proxy server connects to multiple node servers and also connects to electronic devices. The multiple node servers connect to the electronic devices of their respective nodes. (See attached diagram.) Figure 1 The method for accessing electronic devices includes steps 110 to 130.
[0021] Step 110: Obtain the target node server and the current actual node server of the electronic device.
[0022] In some embodiments, the configuration distribution system (Alloc) sends target area configuration information to the electronic device. This configuration information indicates the target node server that the electronic device should connect to. For example, the target node server is a node server in the MQTT (Message Queuing Telemetry Transport) access cluster corresponding to the target area. The proxy server obtains the target node server information of the electronic device through interaction with the configuration distribution system. Furthermore, the proxy server obtains the information of the node server that the electronic device is currently actually connected to through the connection state management module. For example, it obtains the information by calling the query interface provided by the connection state management module or subscribing to device state change events. The target area is the area where the target node server is located.
[0023] For example, taking POS terminal device POS001 as an example, the configuration and distribution system assigns POS001 to a target node server configured with the target region as EU (European Union), indicating that POS001 should connect to the MQTT access cluster in the EU region. The proxy server obtains this target region from the configuration and distribution system and determines that the target node server for POS001 is an MQTT access node in the EU region. At this time, the proxy server queries the connection status management module and finds that POS001 is currently actually connected to an MQTT access node server in the Asia region, thus obtaining that the current actual node server for POS001 is an MQTT access node server in the Asia region.
[0024] Step 120: Determine the current state of the electronic device based on the target node server and the current actual node server.
[0025] In some embodiments, the proxy server compares the target node server of the electronic device with the current actual node server. If they match, the electronic device is determined to be in a normal direct connection state; if they do not match, the electronic device is determined to be in a region inconsistency state, and further, the duration of the inconsistency state is used to determine whether the electronic device is in a migration window.
[0026] For example, the proxy server detects that the target node server for POS001 is a node server in the EU region, while the actual node server is currently a node server in the Asia region, which is inconsistent. The proxy server then begins recording the duration of this inconsistent state. If the duration exceeds a preset first time threshold, it indicates that the electronic device is within a migration window; if the duration does not exceed the first time threshold, it indicates that the electronic device is not within a migration window, and the inconsistent state is determined to be caused by short-term drift errors such as network jitter or temporary switching.
[0027] Step 130: If the status is a migration window period, a temporary proxy takeover channel is established. Under the temporary proxy takeover channel, the device uplink information of the current actual node server is received and forwarded to the target node server; or the business information sent by the target node server is received and forwarded to the actual node server to realize the access of electronic devices.
[0028] For example, when the proxy server determines that electronic device POS001 is within the migration window, it establishes a temporary proxy takeover channel for POS001. During the takeover period, the uplink information generated by POS001 is uploaded to the current actual node server in the Asia region. The current actual node server then sends the uplink information to the proxy server, which forwards it to the target node server in the EU region through the temporary proxy takeover channel. Alternatively, the target node server in the EU region may send business information intended for POS001 to the proxy server first. The proxy server then forwards this business information to the current actual node server in the Asia region through the temporary proxy takeover channel, and the current actual node server transmits the business information to POS001.
[0029] As described above, by connecting multiple node servers and electronic devices through a proxy server, the target node server and the current actual node server of the electronic device are obtained. Based on the comparison results between the target node server and the current actual node server, it is determined whether the electronic device is in a migration window period. This can accurately identify the transitional state where the node server configuration has been updated but the physical connection has not yet been switched to the target node server, thereby identifying situations where the target access area of the electronic device is inconsistent with the actual access area, thus avoiding misjudgment that the device has gone offline or switched during this migration window period. When a migration window period is determined, a temporary proxy takeover channel is established. By receiving the device's uplink information from the current actual node server and forwarding it to the target node server, and receiving the business information sent by the target node server and forwarding it to the current actual node server, bidirectional transparent forwarding of uplink and downlink communication is achieved during the migration window period. This allows the electronic device to maintain normal business communication without being aware of changes in its access location or without actively reconnecting or restarting. This solves the problem of communication path breakage caused by the inaccurate delivery of messages to the target business system during the migration window period, resulting in the inability to use the terminal device normally.
[0030] In some embodiments, step 110 obtains the target node server and the current actual node server of the electronic device, including steps 210 to 240.
[0031] Step 210: Subscribe to the connection establishment event generated by any node server. The connection establishment event is generated when the electronic device establishes a connection with the corresponding node server. The connection establishment event includes the device identifier, the current actual node server identifier, and the session identifier.
[0032] In some embodiments, node servers in each region trigger a connection establishment event when an electronic device establishes a connection with it. The proxy server subscribes to connection establishment events in advance from the connection state management module. When any electronic device successfully establishes a connection with a node server in a certain region, the node server reports the connection establishment event to the connection state management module, which then pushes the event to the proxy server. A session identifier is used to identify the communication session established between the electronic device and the previously accessed node server. A device identifier is used to uniquely identify electronic devices accessing the system, such as POS terminals, and serves as an identity marker distinguishing different terminal devices, such as "POS001," used to index and locate specific electronic devices in connection state information, session mapping relationships, and message routing.
[0033] For example, when electronic device POS001 successfully establishes a long MQTT / TCP (Transmission Control Protocol) connection with node server asia-node-03 in the Asia region, node server asia-node-03 triggers a connection establishment event. This event includes the device identifier POS001, the currently accessing node server identifier asia-node-03, the session identifier SID123, and the connection establishment time. The proxy server receives this connection establishment event through a subscription mechanism.
[0034] Step 220: Based on the connection establishment event, establish connection status information, which includes the mapping relationship between the device identifier and the current actual node server identifier; In some embodiments, after receiving a connection establishment event, the proxy server instructs the connection state management module to establish connection state information based on the connection establishment event. The proxy server obtains the mapping relationship between the electronic device and the current actual node server by calling the query interface provided by the connection state management module or by subscribing to the connection state management module. The connection state information includes at least the mapping relationship between the device identifier and the current actual node server identifier. In addition, by pre-configuring the regional attribute mapping relationship for each MQTT node server, the access node identifier is bound to its region, thereby constructing the mapping relationship between each node server and its corresponding region. For example, the connection state information is constructed by combining the device identifier, the current actual node server identifier, the region to which the current actual node server belongs, and the session representation.
[0035] For example, after receiving the connection establishment event of POS001, the connection status management module establishes the following connection status information: device POS001 is mapped to the current actual node server asia-node-03, the current actual node server asia-node-03 is mapped to the Asia region, and the session identifier is SID123, forming the connection status information "POS001-asia-node-03-Asia-SID123".
[0036] Step 230: Match the corresponding current actual node server identifier in the connection status information based on the device identifier of the electronic device.
[0037] In some embodiments, when the proxy server needs to obtain the current actual access area of an electronic device, it sends a query request to the connection state management module, the request carrying the device identifier of the electronic device. The connection state management module matches the device identifier against the established connection state information and returns the corresponding current actual node server identifier and area. The current actual node server identifier identifies the node server to which the electronic device's current physical connection is connected, indicating the old area access node where the electronic device actually resides during the migration window, such as "asia-node-03".
[0038] For example, the proxy server queries the connection state management module for the current actual access area of electronic device POS001. The connection state management module retrieves connection state information using the device identifier POS001 as an index, and obtains the corresponding access node identifier asia-node-03 and the region Asia.
[0039] Step 240: Determine the current actual node server based on the current actual node server identifier.
[0040] In some embodiments, the proxy server can determine that the node server currently being accessed by the electronic device is the corresponding node server in the MQTT access cluster in the Asia region based on the current actual node server identifier returned by the connection state management module, for example, the current actual node server identifier is asia-node-03.
[0041] As described above, by subscribing to connection establishment events generated by the node server, the proxy server can accurately match the corresponding current actual node server identifier in the connection state information based on the device identifier without directly sensing the network connection. This allows the proxy server to determine the current actual node server and thus obtain the actual access location of the electronic device. By subscribing to connection establishment events and constructing connection state information, the proxy server ensures that the current access area information obtained is consistent with the actual physical connection state of the device, and is unaffected by factors such as DNS caching, terminal firmware differences, or network switching timing.
[0042] In some embodiments, step 120, which determines the current state of the electronic device based on the target node server and the current actual node server, includes steps 310 to 320.
[0043] Step 310: When the target node server is detected to be inconsistent with the current actual node server, record the duration of the inconsistent state.
[0044] In some embodiments, the proxy server continuously or periodically compares the target node server of the electronic device with the current actual node server. When an inconsistency is detected, the proxy server starts a timer to record the duration of the inconsistency. The duration is calculated from the first time the inconsistency is detected.
[0045] For example, when the proxy server first detects that the target region corresponding to the target node server of electronic device POS001 is EU, while the actual region corresponding to the current node server is Asia, the proxy server immediately starts a timer to record the duration of this inconsistency.
[0046] Step 320: If the duration exceeds the preset first time threshold, the electronic device is determined to be in the migration window period.
[0047] In some embodiments, a first time threshold is preset, for example, the first time threshold is set to T seconds. The first time threshold is used to distinguish between brief state jitter and a true migration window. When the duration of an electronic device in a region inconsistency state exceeds the preset first time threshold, the proxy server determines that the electronic device is indeed in a migration window. If the electronic device returns to a normal direct connection state before the first time threshold is exceeded, that is, the target node server is restored to be consistent with the current actual node server, it is determined to be a network jitter or temporary switch, and the electronic device is not in a migration window.
[0048] As described above, by setting a preset first time threshold to determine the duration of regional inconsistency, a timer is started when the target node server is detected to be inconsistent with the current actual node server. Only when the inconsistency exceeds the preset first time threshold is the electronic device determined to have entered the migration window period. This avoids frequent state switching caused by transient anomalies such as network jitter, DNS cache not being refreshed in time, or occasional terminal reconnection failures. This allows the proxy server to accurately distinguish between the true device migration and stagnation state and the temporary network disturbance state, thereby avoiding unnecessary proxy takeover of the transient deviation state and ensuring the accuracy of migration window period identification.
[0049] In some embodiments, step 120 determines the current state of the electronic device based on the target node server and the current actual node server, including steps 330 to 340.
[0050] Step 330: When the target node server is detected to be inconsistent with the current actual node server, record the downtime of the electronic device.
[0051] In some embodiments, when an electronic device loses its connection due to network switching or reconnection during migration, it will be in a brief offline state. After detecting the connection interruption, the proxy server records the start time of the device's downtime and begins timing. Downtime refers to the duration during which the electronic device has no valid connection to any node server.
[0052] Step 340: If the downtime exceeds the preset third time threshold, the electronic device is determined to be in the migration window period.
[0053] In some embodiments, a preset third time threshold is used to determine whether a device remains offline for an extended period due to anomalies during the migration process. When the downtime of an electronic device exceeds the preset third time threshold, the proxy server determines that the device is within the migration window.
[0054] As described above, by recording the downtime of electronic devices when the target node server is detected to be inconsistent with the current actual node server, and determining that the electronic device is in a migration window period when the downtime exceeds a preset third time threshold, a reliable basis for identifying the migration window period when the device is completely offline due to network switching, disconnection and reconnection, or long connection release delay during the migration process is provided. When the device has no effective connection with any regional nodes, there is no "current actual access area" for comparison, ensuring that the device can be included in the migration window period identification range regardless of whether it is in an "online lingering in the old area" or "offline switching". By introducing a downtime threshold, it prevents momentary offline due to brief signal interruption or route convergence from being mistakenly judged as a migration window period, and ensures that long-term offline due to actual network switching delay can be identified in a timely manner.
[0055] In some embodiments, step 130, establishing a temporary agent takeover channel, includes steps 410 to 430.
[0056] Step 410: Generate a corresponding proxy session identifier for the electronic device.
[0057] In some embodiments, when the proxy server determines that an electronic device has entered the migration window, the proxy server generates a unique proxy session identifier for the electronic device, such as ProxySessionID. The proxy session identifier is used to uniquely identify the proxy session corresponding to the electronic device during the migration period in the proxy server.
[0058] Step 420: Establish a session mapping relationship based on the proxy session identifier, device identifier, current actual node server identifier, and target node server identifier.
[0059] In some embodiments, the proxy server creates a session mapping relationship based on device connection status information, establishing an association between the electronic device, the current actual node server, the target node server, and the proxy session in the session consistency management module. The session mapping relationship includes the electronic device identifier, the proxy session identifier, the current actual node server identifier, the target node server identifier, and the proxy session identifier. The target node server identifier is used to identify the node server in the target access area issued by the configuration distribution system (Alloc) to the electronic device, representing the new area node to which the electronic device's service should be switched, such as "eu-node-02".
[0060] Step 430: Based on the session mapping relationship, establish a temporary proxy takeover channel between the current actual node server and the target node server.
[0061] In some embodiments, the proxy server registers the established session mapping relationship with the session consistency management module. This session mapping relationship enables all subsequent messages targeting the electronic device to quickly find the corresponding proxy path based on the device identifier. The proxy server establishes a bidirectional forwarding channel, i.e., a temporary proxy takeover channel, between the current actual node server and the target node server based on this session mapping relationship.
[0062] As described above, by generating a unique proxy session identifier for electronic devices within the migration window and establishing a session mapping relationship between this proxy session identifier and the device identifier, the current actual node server identifier, and the target node server identifier, a temporary proxy takeover channel is established between the current actual node server and the target node server based on the session mapping relationship. This constructs a cross-regional logical forwarding path for a single device. By using the proxy session identifier as an index and the session mapping relationship as the basis for message routing, a channel is established only for the single device truly within the migration window, without needing to establish a full forwarding link for the entire region. This avoids unnecessary cross-regional message duplication and bandwidth consumption while ensuring the accuracy of proxy forwarding.
[0063] In some embodiments, step 130, under the temporary agent takeover channel, involves receiving the device uplink information from the current actual node server and forwarding the device uplink information to the target node server; or receiving the service information sent by the target node server and forwarding the service information to the actual node server, including steps 440 to 450.
[0064] Step 440: When it is detected that the electronic device is sending device uplink information to the current actual node server, the device uplink information is obtained from the current actual node server and forwarded to the target node server through the temporary proxy takeover channel.
[0065] In some embodiments, while the temporary proxy takeover channel is active, the proxy server continuously monitors messages originating from the electronic device on the current actual node server. When the electronic device sends uplink information to the current actual node server, the current actual node server forwards the information to the proxy server. The proxy server queries the session mapping relationship based on the device identifier to identify that the electronic device is in proxy takeover mode, and then forwards the received uplink information to the business system corresponding to the target node server through the temporary proxy takeover channel, thereby ensuring that the uplink information can be correctly received and processed by the business system in the target area.
[0066] Step 450: When it is detected that the target node server sends out service information for electronic devices, the service information is obtained from the target node server and forwarded to the current actual node server through the temporary proxy takeover channel, so as to instruct the current actual node server to send the service information to the electronic devices.
[0067] In some embodiments, while the temporary proxy takeover channel is active, the proxy server monitors downlink service information for the electronic device on the target node server. When the target node server's business system needs to send service information to the electronic device, the service information is first sent to the proxy server. The proxy server queries the session mapping relationship based on the device identifier and forwards the service information to the current actual node server through the temporary proxy takeover channel. The current actual node server then delivers the service information to the electronic device through the long-term connection it maintains with the electronic device.
[0068] As described above, by monitoring messages on both the uplink and downlink paths during the activation of the temporary proxy takeover channel, the system promptly acquires and forwards uplink information to the target node server when it detects an electronic device sending uplink information to the current actual node server, and promptly acquires and forwards business information to the current actual node server when it detects the target node server sending business information for that electronic device. This achieves transparent forwarding and path compensation of uplink and downlink business information even before the electronic device has completed its physical area switch. By using session mapping as the routing basis, the business system uses the target node server as the communication target, while the electronic device remains in the original access area's communication link. Neither party needs to be aware of the other's actual location change to complete normal communication. Therefore, during the entire migration window when the device remains in the old area, the system resolves business anomalies such as transaction authorization failures and state synchronization failures caused by communication path breaks, ensuring business continuity during cross-regional migration.
[0069] In some embodiments, the access method 100 for an electronic device further includes steps 140 to 150.
[0070] Step 140: Determine whether the subscribed connection establishment event has been updated. If so, update the connection status information of the electronic device according to the updated connection establishment event.
[0071] In some embodiments, the proxy server continuously subscribes to connection establishment events in the connection state management module, determining whether each connection establishment event has changed. When an electronic device switches connections, such as disconnecting from its original region and successfully connecting to a target region, the node server in the corresponding target region generates a new connection establishment event and reports it to the connection state management module. The proxy server receives this update event through a subscription mechanism, thus learning that the electronic device's current actual access region has changed, i.e., the current actual node server has changed.
[0072] Step 150: Determine whether the electronic device has successfully connected to the target node server based on the updated connection status information.
[0073] In some embodiments, after receiving a status update from a connection establishment event, the proxy server obtains the connection stability information of the device within the target area through the connection status management module to determine whether the device has stably connected to the target node server. If it is determined that a stable connection has been established, the proxy server releases the temporary proxy takeover channel; if a stable connection has not yet been established, the proxy server maintains the proxy takeover state.
[0074] As described above, by continuously subscribing to connection establishment events in the connection status management module, the connection status information of the electronic device is updated in a timely manner when an event update is detected. Furthermore, the updated connection status information is used to determine whether the device has completed access to the target node server. The proxy server uses the continuously updated connection status information in the connection status management module as the basis for judgment, ensuring timely perception and accurate judgment of changes in the device access status.
[0075] In some embodiments, step 150, which determines whether the electronic device has successfully accessed the target node server based on the updated connection status information, includes steps 510 to 530.
[0076] Step 510: Calculate the duration of the connection between the electronic device and the target node server based on the current time and the most recent heartbeat time in the connection status information.
[0077] In some embodiments, when an electronic device is detected sending a heartbeat keep-alive signal to the target node server, the heartbeat event corresponding to the heartbeat keep-alive signal is obtained from the target node server; the most recent heartbeat time corresponding to the electronic device in the connection status information is updated according to the heartbeat event. The connection status management module continuously maintains the connection status information of the electronic device on each regional node, including the most recent heartbeat time and continuous stable state. The electronic device maintains a long-term connection keep-alive mechanism with each node server, and the device sends a heartbeat keep-alive signal according to a preset period. After receiving the heartbeat keep-alive signal, the access node generates a heartbeat event and synchronizes it to the connection status management module, which updates the device's most recent heartbeat time. When the proxy server needs to determine whether the device has completed access to the target area, it obtains the device's most recent heartbeat time in the target area by querying the connection status management module and calculates the connection duration in combination with the current time.
[0078] Step 520: If the connection duration exceeds the preset second time threshold, it is determined that the electronic device has completed access to the target node server. Based on the proxy session identifier corresponding to the electronic device, the session mapping relationship corresponding to the proxy session identifier is deleted, and the connection to the temporary proxy takeover channel corresponding to the deleted session mapping relationship is terminated.
[0079] In some embodiments, a preset second time threshold is used to determine whether the connection of the electronic device within the target area has reached a stable state. When the duration of continuous valid heartbeats of the device within the target area exceeds the preset second time threshold, the proxy server determines that the device has stably accessed the target area and then triggers the proxy relationship termination process. In the proxy relationship termination process, the proxy server looks up the corresponding proxy session identifier based on the device identifier of the electronic device, deletes the session mapping relationship corresponding to the proxy session identifier in the session consistency management module, and releases the corresponding temporary proxy takeover channel.
[0080] Step 530: Directly establish communication between the electronic device and the target node server.
[0081] In some embodiments, after the proxy server terminates the temporary proxy takeover of the channel, the electronic device and the target node server revert to direct connection mode. The electronic device communicates directly with the target node server in the target area, and the business system interacts directly with the target node server; all business communication no longer passes through the proxy server.
[0082] As described above, the connection duration between the device and the target node server is calculated based on the current time and the most recent heartbeat time in the connection status information. The device is only considered to have completed access when the connection duration exceeds a preset second time threshold. Then, the session mapping relationship is deleted and the temporary proxy takeover channel is released based on the proxy session identifier corresponding to the device. Communication between the device and the target node server is then directly established, thereby achieving a reliable switch from proxy takeover mode to standard direct connection mode.
[0083] Figure 2 This is a timing diagram illustrating the cross-regional migration of a device using an access method for an electronic device according to an embodiment of the present invention. (Refer to...) Figure 2 The components involved in the interaction include the POS terminal, the Alloc configuration center (i.e., the configuration distribution system), the Proxy layer (i.e., the proxy server), the Asia MQTT cluster (i.e., the MQTT cluster in the Asia region), and the EU MQTT cluster (i.e., the MQTT cluster in the EU region). Figure 3 This is a flowchart illustrating another step of an access method for an electronic device provided by an embodiment of the present invention. (Refer to...) Figure 2 and Figure 3 This embodiment includes steps 201 to 206.
[0084] Reference Figure 2 This includes steps 201 to 206.
[0085] Step 201: Obtain the target node server.
[0086] For example, the electronic device is a POS terminal. The POS terminal obtains its target node server through the configuration distribution system (Alloc). The configuration distribution system issues a target area configuration to each electronic device, indicating the area where the target node server should be located. For example, device POS001 is configured with the target area corresponding to the target node server as EU, indicating that its business should be switched to the node server in the EU area. This corresponds to step 110.
[0087] Step 202: Obtain the current actual node server.
[0088] The proxy server continuously detects and obtains the current actual region information of the electronic device to determine the current actual node server. For example, electronic device POS001 remains at the node server of the MQTT cluster in the Asia region at the physical connection level. This corresponds to step 110.
[0089] The proxy server achieves this through a centralized maintenance mechanism of connection event reporting and connection state management modules on the access node server side of electronic devices, including the following steps: Connection Event Acquisition: When a POS terminal establishes a connection with an MQTT access cluster in a certain region, the corresponding MQTT access node server triggers a connection establishment event after the connection is successfully established. This connection establishment event includes at least the device identifier, the current access node identifier (i.e., the current actual node server identifier), the session identifier, and the connection establishment time. For example, when device POS001 accesses the MQTT cluster in the Asia region, a connection establishment event is generated. This corresponds to step 210.
[0090] Establishing a region mapping relationship: By pre-configuring the region attribute mapping relationship for the node servers in each MQTT cluster, the current access node identifier is bound to its corresponding region. For example, the current access node identifier asia-node-03 is mapped to the Asia region, and the current access node identifier eu-node-02 is mapped to the EU region, thus forming a mapping relationship from the current access node to the region. This corresponds to step 220.
[0091] Connection Status Registration: The current access node (i.e., the current actual node server) registers the device connection information with the connection status management module, forming a real-time mapping relationship between the electronic device and the current access node. The device connection information includes at least the device identifier, the current access node identifier, the session identifier, and the current access region. The current access region is the region where the current access node is located. For example, the device connection information is: Device Identifier POS001 - Current Access Node Identifier asia-node-03 - Current Access Region Asia - Session Identifier SID123. This corresponds to step 220.
[0092] Continuous connection status maintenance: During the connection of the electronic device, the node server continuously updates the connection status information through heartbeat keep-alive, connection renewal, or status refresh mechanisms; when the device disconnects or reconnects, the connection status management module synchronously updates or deletes the corresponding records to ensure the real-time performance and consistency of the electronic device's current access area. This corresponds to step 220.
[0093] Current Access Region Acquisition: The proxy server obtains the current actual access region of the device, i.e., the current actual node server, by calling the query interface provided by the connection state management module or subscribing to the state change event of the connection establishment event of the electronic device. For example, when the proxy server queries the electronic device POS001, the connection state management module returns its current access region as Asia. This corresponds to step 230.
[0094] Consistency check trigger: The proxy server compares the current access region it obtains with the target region issued by the configuration distribution system. When the two are inconsistent, the migration window identification and subsequent session-level proxy takeover process are triggered. This corresponds to the trigger judgment before step 120 after determining the current actual node server in step 240.
[0095] For example, taking electronic device POS001 as an example, the configuration distribution system assigns POS001 to a target node server whose target region has been updated to EU. However, because the MQTT / TCP long connection has not been released, the electronic device continues to connect to the node server of the MQTT cluster in the Asia region. This node server continuously reports the connection establishment event and subsequent heartbeat status to the connection state management module, so that the system maintains the record that "POS001's current access region is Asia". When the proxy server queries the connection state management module, it obtains the current access region CurrentRegion=Asia and combines it with the target region TargetRegion=EU, determining that the electronic device is in a region inconsistency state, thereby triggering the migration window identification process and entering the subsequent temporary proxy takeover stage.
[0096] Step 203: Identify the migration window period.
[0097] The proxy server further performs a consistency check between the target area and the current access area of the electronic device to determine if there is any inconsistency. When a difference is detected between the target area and the current access area, the proxy server includes the device in the migration window identification process. This corresponds to step 120.
[0098] The proxy server determines the duration of the inconsistency state. When the inconsistency between the target area and the current access area of an electronic device continues for more than a preset time threshold T (i.e., the first time threshold), the device is determined to be in a migration window. This state indicates that the device has completed the configuration update of the target area, but remains in the old access area due to reasons such as unreleased long connections, failed reconnections, or network switching delays. This corresponds to step 120.
[0099] Step 204: Establish a temporary agent takeover channel.
[0100] After entering the migration window, the proxy server establishes a session-level temporary proxy takeover channel for the electronic device, forming a temporary session mapping relationship between the MQTT cluster in the current access region (e.g., Asia) and the business nodes in the target region (e.g., EU). This corresponds to step 130. The establishment of the temporary proxy takeover channel includes the following steps: Takeover Trigger: When the proxy server detects that the current access area of an electronic device is inconsistent with the target area, and the duration exceeds a preset time threshold T, it determines that the device has entered the migration window period and triggers the temporary proxy takeover channel establishment process. This corresponds to step 410.
[0101] Proxy session creation and identifier generation: The proxy server generates a unique proxy session identifier, such as ProxySessionID, for the electronic device and creates a corresponding session record in the session consistency management module to identify the temporary routing state of the device during migration. This corresponds to step 410.
[0102] Establishing a session mapping relationship: The proxy server creates a session mapping relationship based on the connection state information and associates it with the device identifier, current access area, target area, and proxy status information. For example, for device POS001, when its target area is EU but its current actual access area is still Asia, the proxy server creates a proxy session PS001 for it and establishes a session mapping relationship of "device POS001 is currently accessing the Asia area, its target access area is the EU area, and its proxy status is ProxyMode". This corresponds to step 420.
[0103] Register session information: The proxy server registers the established session mapping relationship with the session consistency management module, enabling subsequent message forwarding to quickly query the corresponding proxy path based on the device identifier. This corresponds to step 430.
[0104] Message routing binding: The proxy server establishes a communication association between the electronic device and the target node server based on the session mapping relationship, so that both device messages and service requests are forwarded through the proxy session. During the proxy state, all service messages for this device are preferentially routed through the corresponding proxy relationship. This corresponds to step 430. Furthermore, the proxy server establishes uplink and downlink bidirectional forwarding rules based on the relationship between the electronic device's current access area and the target area: Uplink direction: After the device service message (i.e., device uplink information) enters the proxy server from the current access area, it is forwarded to the service node in the target area; corresponding to step 440; Downlink direction: Service information sent from the service node in the target area to the electronic device first enters the proxy server, and then is forwarded to the current actual node server in the current access area. This corresponds to step 450.
[0105] Transparent proxy forwarding execution: During the proxy state, the proxy server queries the session mapping relationship based on the device identifier and performs route rewriting and forwarding processing on all sent and received messages. This ensures that the business system always uses the target area as the communication object, while the device remains in the original access area communication link, thereby achieving cross-regional communication consistency. This corresponds to step 130.
[0106] Session state maintenance: The proxy server continuously maintains the proxy session state, including message forwarding records, last communication time, and connection validity; if a device area switch is detected as complete, proxy forwarding stops. This corresponds to step 130.
[0107] At this time, the uplink communication path of the device is as follows: the POS terminal transmits the device's uplink information to the proxy server via the current actual node server in the current access area (such as Asia), and then the proxy server forwards it to the target node server in the target area (such as EU); corresponding to step 440; the downlink communication path is as follows: the target node server in the target area sends the business information to the proxy server, the proxy server then delivers the business information to the current actual node server in the current access area, and finally delivers it to the POS terminal, corresponding to step 450.
[0108] Step 205: After the target area is connected, perform a heartbeat stability test.
[0109] When the proxy server detects that an electronic device has successfully connected to the target region, such as the EU, and the heartbeat keep-alive signal remains stable and continues for more than a preset period M (i.e., the second time threshold), it determines that the device has completed the region handover. The heartbeat keep-alive signal is maintained by the connection state management module and implemented in conjunction with the connection keep-alive mechanism of the current access node in the MQTT cluster, including the following steps: Heartbeat Status Establishment: After an electronic device successfully connects to the MQTT cluster in the target area, the corresponding access node establishes connection status information for the electronic device and creates a corresponding heartbeat monitoring relationship in the connection status management module, associating the device identifier, current access area, most recent heartbeat time, and stable status information. This corresponds to step 140.
[0110] Heartbeat signal acquisition: The electronic device maintains an MQTT long-connection keep-alive mechanism with the current access node of the MQTT cluster. The device sends heartbeat keep-alive messages according to a preset period, or uses the MQTT protocol's own PINGREQ / PINGRESP mechanism to maintain the connection state; the current access node generates a heartbeat event after receiving the heartbeat keep-alive signal. This corresponds to step 510.
[0111] Heartbeat status synchronization: The current access node of the MQTT cluster continuously synchronizes the received heartbeat events to the connection status management module, which then updates the latest heartbeat time and stable status information of the electronic device and continuously maintains the connection validity of the electronic device. This corresponds to step 510.
[0112] Stable period determination: The connection status management module continuously counts the duration of continuous valid heartbeats of the electronic device within the target area. When the device's continuous heartbeats remain normal and continue for more than the preset period M, it is determined that the device has stably connected to the target area. If a heartbeat timeout, connection loss, or area change occurs during monitoring, the monitoring state is re-entered. This corresponds to step 520.
[0113] Migration Completion Confirmation: Once the electronic device meets the stable cycle conditions, the connection status management module sends a migration completion event to the proxy server, notifying the electronic device that its current access area and target area are now consistent. This corresponds to step 520.
[0114] During the session proxy state, the proxy server performs consistency compensation processing on all uplink and downlink messages to ensure the correct reachability of business messages. In this process, the business system does not need to be aware of the actual access area of the device, and the POS terminal does not need to reconnect, restart, or upgrade, thus achieving communication path consistency and business continuity assurance during cross-regional migration.
[0115] For example, taking electronic device POS001 as an example, the device initially connects to the current actual node server of the MQTT cluster in the Asia region. During system evolution, the configuration center changes its target region to the EU region, but because the MQTT / TCP long connection on the device side is not released in time, the device still maintains the Asia region connection. After the proxy detects that the device's target region EU and the current access region Asia are continuously inconsistent and exceed the preset threshold T, it creates a temporary proxy session PS001 and establishes a session mapping relationship between device POS001, the current region Asia, and the target region EU. Subsequently, the proxy server registers this session with the session consistency management module, so that all subsequent communication requests for POS001 can locate the corresponding proxy relationship through PS001.
[0116] Session mapping relationships are dynamically established at the device level, creating proxy relationships only for devices in the migration window, without the need to establish a full region-level bridge, thereby reducing cross-regional communication overhead and improving system resource utilization efficiency.
[0117] For example, taking electronic device POS001 as an example, the current access area of the electronic device is the Asia region, and the target area is configured as EU during the migration process. After the electronic device completes the network switch, it reconnects to the target node server in the EU region. The target node server establishes connection status information and starts heartbeat monitoring. The electronic device continuously sends MQTT heartbeat keep-alive signals to the target node server according to a preset period. The target node server continuously receives the heartbeat keep-alive signals of the electronic device and synchronizes them to the connection status management module. The connection status management module continuously calculates the stable connection time of the electronic device in the EU region based on the continuously received valid heartbeat keep-alive signals. If the set stability period M is 120 seconds, when it is detected that POS001 maintains a normal heartbeat for 120 consecutive seconds in the EU region without any region change, it is determined that the electronic device has completed the region switch, that is, it has switched to the target node server in the target region, and sends a migration completion notification to the proxy server. After receiving the notification, the proxy server terminates the temporary session proxy relationship established between the Asia region and the EU region, and restores the device to the EU region standard direct connection mode.
[0118] The connection status management module is responsible for maintaining heartbeat status information, and the MQTT access node is responsible for collecting device keep-alive events. The two work together to detect device connection stability, thereby avoiding the premature release of the proxy relationship due to brief device reconnection or network jitter.
[0119] Step 206: Termination of agency relationship and restoration of direct connection.
[0120] After receiving the migration completion event, the proxy server releases the session-level proxy takeover relationship corresponding to the electronic device. For example, it deletes the corresponding proxy session identifier and the corresponding session mapping relationship, terminates the temporary proxy takeover channel, and updates its access status to be consistent with the current region and the target region. This corresponds to step 520.
[0121] At this point, the system reverts to the standard multi-region direct communication mode, where devices communicate directly with the target region's service nodes without going through a proxy server. This corresponds to step 530.
[0122] The following is an example of this application: Taking POS terminal device POS001 as an example, in its initial state, the device actually connects to the MQTT access cluster in the Asia region and maintains a long-term connection session with the region.
[0123] The proxy server obtains the connection status of each device in real time through the subscription mechanism of the connection state management module. During the system's cross-regional evolution, the configuration distribution system (Alloc) issues a new target region configuration to POS001, indicating that its target region is the EU region. The proxy server obtains this configuration information from the configuration distribution system and determines that the target node server of POS001 is the target node server of the EU region. At the same time, the proxy server obtains the current access region of POS001 as the Asia region by querying the connection state management module.
[0124] The proxy server compares the target region (EU) of POS001 with the current access region (Asia). Finding a discrepancy, it starts a timer to record the duration of this inconsistency. Using a preset first time threshold T=30 seconds, if the inconsistency lasts longer than 30 seconds, the proxy server determines that POS001 has entered the migration window.
[0125] Upon entering the migration window, the proxy server generates a unique proxy session identifier PS001 for POS001 and establishes the following session mapping relationship in the session consistency management module: device identifier POS001, proxy session identifier PS001, current access region Asia, target region EU, and proxy status ProxyMode. Based on this session mapping relationship, the proxy server establishes a temporary proxy takeover channel between the current actual node server in the Asia region and the target node server in the EU region.
[0126] During the temporary proxy takeover channel activation period, transaction requests generated by POS001 are uploaded to the current actual node server in the Asia region via the MQTT protocol. The current actual node server in the Asia region then forwards the transaction request to the proxy server. The proxy server, based on the device identifier POS001, queries the session mapping relationship to identify that the device is in proxy takeover mode. It then forwards the transaction request to the target node server in the EU region through the temporary proxy takeover channel, where the EU business system completes the transaction authorization and processing. The transaction response information generated by the EU business system is forwarded by the proxy server to the current actual node server in the Asia region. The current actual node server in the Asia region then sends the response back to POS001 through the MQTT / TCP long connection maintained between itself and POS001, completing a full cross-regional communication compensation cycle.
[0127] After POS001 completes the network switch and successfully connects to the target node server in the MQTT cluster of the EU region, the target node server in the EU region generates a new connection establishment event and reports it to the connection state management module. The proxy server receives this update event by subscribing. The target node server in the EU region continuously receives MQTT keep-alive messages from POS001 and synchronizes them to the connection state management module, which then updates the most recent heartbeat time of POS001 in the EU region. By setting a second time threshold of M seconds, when the proxy server detects that POS001 has maintained a normal heartbeat for M seconds continuously in the EU region, it determines that POS001 has completed stable access to the target region EU.
[0128] The proxy server then deletes the session mapping relationship in the session consistency management module based on the proxy session identifier PS001 corresponding to POS001, thus releasing the temporary proxy takeover channel between the Asia region and the EU region. Afterward, POS001 communicates directly with the EU region's business system through the target node server of the MQTT cluster in the EU region, restoring the standard multi-region direct connection access mode.
[0129] As described above, the access method for electronic devices provided by this invention enables transparent forwarding and path compensation for uplink and downlink communication when the device remains in the old access area due to reasons such as unreleased MQTT / TCP long connections, DNS cache lag, uncontrollable network switching timing, or differences in terminal firmware. This ensures the consistency of communication paths and business continuity during cross-region migration, while avoiding resource waste caused by full cross-domain routing or MQTT clusters.
[0130] Please refer to Figure 4 The present invention also provides a structural diagram of an access system for an electronic device. (Refer to...) Figure 4The system includes: a main server 401, a proxy server 402, an electronic device 403, a first node server 404, and a second node server 405. The main server 401 is used to send target node server configuration information to the electronic device 403. The proxy server 402 is used to execute an access method for the electronic device 403. The electronic device 403 is used to establish a communication connection with the current actual node server, receive the target node server configuration information sent by the main server 401, obtain the target node server from the target node server configuration information, and perform a switch from the current actual node server to the target node server. The first node server 404 is used as the current actual node server of the electronic device 403, establishes a communication connection with the electronic device 403, receives uplink information sent by the electronic device 403, and receives service information forwarded by the proxy server 402 and sends it to the electronic device 403. The second node server 405 is used as the target node server of the electronic device 403, receives uplink information forwarded by the proxy server 402, and sends service information for the electronic device 403 to the proxy server 402.
[0131] Please refer to Figure 5 The present invention also provides a cloud server 500, including a memory 501 and a processor 502, and a computer program stored on the memory 501 and running on the processor 502. When the processor 502 executes the computer program, it implements the various steps in the above-described method for accessing an electronic device.
[0132] The beneficial effects of the system and electronic device of the present invention are the same as those of the method described above, and will not be repeated here.
[0133] In summary, this application provides an access method and system for electronic devices, as well as a cloud server, which has the following beneficial effects: It can ensure business continuity during cross-regional evolution. When the system expands from a single-region centralized architecture to a multi-region distributed architecture, it can continuously ensure uninterrupted communication between devices and business systems even before the devices have completed physical region switching, thereby avoiding business unavailability issues during migration. It can solve the regional inconsistency problem caused by long connection retention. For the problem of "target region changed but actual access not switched" caused by reasons such as untimely release of MQTT / TCP long connections, uncontrollable reconnection timing, or network switching delays, an automatic compensation mechanism within the migration window period eliminates communication anomalies caused by access mismatch. It can reduce the resource consumption of cross-regional full forwarding. Unlike the existing technology that uses a full MQTT Bridge or global cross-domain routing, this invention only establishes a temporary proxy relationship for devices during the migration window period, avoiding unnecessary cross-regional full message forwarding, thereby significantly reducing network bandwidth and system resource overhead. This invention enables fine-grained control at the session level. Using a single-device session as the smallest control granularity, it temporarily takes over and compensates for stranded devices, rather than performing global routing adjustments. This ensures system stability while achieving fine-grained management of large-scale device migration. It reduces terminal modification and maintenance costs. Throughout the cross-regional migration process, POS terminals do not require software upgrades, firmware updates, or manual restarts, nor do they require special adaptations to business systems, achieving a smooth migration and significantly reducing terminal modification costs and on-site maintenance investment. It improves the stability of large-scale migrations: This method is particularly suitable for large-scale device migration scenarios where a single-region architecture gradually evolves into a multi-region architecture. It effectively reduces service jitter, message loss, and handover failure rates during the migration process, significantly improving the overall stability and controllability of the system migration.
[0134] The above are merely embodiments of the present invention and do not limit the patent scope of the present invention. Any equivalent modifications made based on the content of the present invention's specification and drawings, or direct or indirect applications in related technical fields, are similarly included within the patent protection scope of the present invention.
Claims
1. A method for accessing an electronic device, characterized in that, The method, applied to a proxy server connected to multiple node servers and also connected to electronic devices, wherein the multiple node servers are connected to electronic devices corresponding to the nodes, includes: Obtain the target node server and the current actual node server of the electronic device; The current state of the electronic device is determined based on the target node server and the current actual node server; If the status is a migration window period, a temporary proxy takeover channel is established. Under the temporary proxy takeover channel, the device uplink information of the current actual node server is received and forwarded to the target node server; or the service information sent by the target node server is received and forwarded to the actual node server to realize the access of the electronic device.
2. The method according to claim 1, characterized in that, Obtaining the target node server and the current actual node server of the electronic device includes: Subscribe to a connection establishment event generated by any node server. The connection establishment event is generated when the electronic device establishes a connection with the corresponding node server. The connection establishment event includes a device identifier, the current actual node server identifier, and a session identifier. Based on the connection establishment event, connection status information is established, which includes the mapping relationship between the device identifier and the current actual node server identifier. Based on the device identifier of the electronic device, match the corresponding current actual node server identifier in the connection status information; The current actual node server is determined based on the current actual node server identifier.
3. The method according to claim 1, characterized in that, Determining the current state of the electronic device based on the target node server and the current actual node server includes: When the target node server is detected to be inconsistent with the current actual node server, the duration of the inconsistent state is recorded; If the duration exceeds a preset first time threshold, the electronic device is determined to be in the migration window period.
4. The method according to claim 2, characterized in that, The establishment of a temporary proxy takeover channel includes: Generate a corresponding proxy session identifier for the electronic device; Establish a session mapping relationship based on the proxy session identifier, the device identifier, the current actual node server identifier, and the target node server identifier; Based on the session mapping relationship, a temporary proxy takeover channel is established between the current actual node server and the target node server.
5. The method according to claim 1, characterized in that, Under the temporary agent takeover channel, the device uplink information of the current actual node server is received, and the device uplink information is forwarded to the target node server; Alternatively, receiving service information sent by the target node server and forwarding the service information to the actual node server includes: When it is detected that the electronic device sends the device uplink information to the current actual node server, the device uplink information is obtained from the current actual node server and forwarded to the target node server through the temporary proxy takeover channel; When the target node server is detected to send the service information for the electronic device, the service information is obtained from the target node server and forwarded to the current actual node server through the temporary proxy takeover channel, so as to instruct the current actual node server to send the service information to the electronic device.
6. The method according to claim 2, characterized in that, Also includes: Determine whether the subscribed connection establishment event has been updated. If so, update the connection status information of the electronic device according to the updated connection establishment event. Based on the updated connection status information, determine whether the electronic device has successfully connected to the target node server.
7. The method according to claim 6, characterized in that, The step of determining whether the electronic device has successfully connected to the target node server based on the updated connection status information includes: Calculate the duration of the connection between the electronic device and the target node server based on the current time and the most recent heartbeat time in the connection status information; If the duration of the connection exceeds a preset second time threshold, it is determined that the electronic device has completed access to the target node server, and according to the proxy session identifier corresponding to the electronic device, the session mapping relationship corresponding to the proxy session identifier is deleted, and the connection to the temporary proxy takeover channel corresponding to the deleted session mapping relationship is terminated. Directly establish communication between the electronic device and the target node server.
8. The method according to claim 1, characterized in that, Determining the current state of the electronic device based on the target node server and the current actual node server includes: When the target node server is detected to be inconsistent with the current actual node server, the downtime of the electronic device is recorded; If the downtime exceeds a preset third time threshold, the electronic device is determined to be in the migration window period.
9. An access system for electronic devices, characterized in that, The system includes: a main server, a proxy server, electronic devices, a first node server, and a second node server; The main server is used to send target node server configuration information to the electronic device; The proxy server is used to execute the access method for an electronic device according to any one of claims 1 to 8; The electronic device is used to establish a communication connection with the current actual node server, receive the target node server configuration information sent by the main server, obtain the target node server from the target node server configuration information, and perform a switch from the current actual node server to the target node server. The first node server is used as the current actual node server of the electronic device, establishes a communication connection with the electronic device, receives the device uplink information sent by the electronic device, and receives the service information forwarded by the proxy server and sends it to the electronic device. The second node server is used as the target node server of the electronic device, to receive the uplink information of the device forwarded by the proxy server, and to send service information for the electronic device to the proxy server.
10. A cloud server, characterized in that, include: The memory is configured to store executable programs; as well as A processor is configured to execute the program to perform an access method for an electronic device according to any one of claims 1 to 8.
