Data migration method and device, electronic equipment and medium

By controlling message and communication connection information, the complexity and security issues of cross-platform chat history migration in instant messaging applications are resolved, enabling data migration and merging between cross-platform devices, and improving user experience and ease of operation.

CN121644660APending Publication Date: 2026-03-10TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411219682.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-30
Publication Date
2026-03-10

AI Technical Summary

Technical Problem

Existing instant messaging applications' chat history migration function only supports migration between devices on the same platform, which is complicated and poses security risks, and cannot achieve flexible and efficient data migration across platforms.

Method used

Data migration between different platform devices is achieved through control messages, communication request messages, and communication connection information. Candidate devices for migratable data are displayed, and the target device can be selected. Chat history migration and merging across multiple platforms are supported, and serialized data transmission is used to improve compatibility and flexibility.

Benefits of technology

It has improved cross-platform compatibility and flexibility, allowing users to easily select target devices, optimize the operation process, and support easy synchronization of message backups and merging of chat history across different devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121644660A_ABST
    Figure CN121644660A_ABST
Patent Text Reader

Abstract

The invention provides a data migration method and device, electronic equipment and a medium. The method comprises the following steps: displaying candidate devices capable of migrating data, and determining a target device from the candidate devices in response to an operation of selecting the target device in which the data is migrated; sending a control message to each device corresponding to the account to which the data belongs, wherein the control message indicates device discovery information related to the data migration object; broadcasting a communication request message, the communication request message indicating information of a communication interface of the emigration device of the data, and the communication interface being used for transmitting the data; receiving a communication connection message of the target device, wherein the communication connection message indicates that the target device can receive data; and migrating the data to a target device after the communication connection with the target device of the data is established. According to the embodiment of the invention, through the control message, the communication request message and the communication connection information, the cross-platform compatibility and flexibility are improved on the premise of ensuring the security of the data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to a method, apparatus, electronic device, and medium for data migration. Background Technology

[0002] With the rapid development of modern internet technology, instant messaging (IM) applications have become an indispensable part of people's daily lives and work. However, the chat history migration function of instant messaging applications has significant technical limitations. Currently, most applications only support chat history migration between mobile devices, a process that typically requires QR code scanning and relies on a communication connection within a local area network. After the sending end generates a QR code, the receiving end scans the QR code to obtain the necessary information and establish a connection. Subsequently, the sending end transmits the chat history data to the receiving end.

[0003] This migration method is relatively complex in terms of operation and requires that both the incoming and outgoing devices use the same platform, causing inconvenience to users and posing certain security risks. Therefore, traditional chat history migration solutions need to be improved. Summary of the Invention

[0004] According to one aspect of this disclosure, a method for data migration is provided, the method comprising: displaying candidate devices for migratable data, and determining a target device from the candidate devices in response to an operation of selecting a target device to which the data is to be migrated; sending a control message to each device corresponding to an account to which the data belongs, the control message indicating device discovery information related to the data migration object; broadcasting a communication request message indicating information about a communication interface of the data's originating device, the communication interface being used for data transmission; receiving a communication connection message from the target device, the communication connection message indicating that the target device is capable of receiving data; and migrating the data to the target device after establishing a communication connection with the target device of the data.

[0005] According to another aspect of this disclosure, a method for migrating data is provided, comprising: receiving a control message indicating device discovery information related to a data migration object; receiving a communication request message indicating information about a communication interface of a data migration originating device, the communication interface being used for transmitting data; in response to a data migration object in the control message matching a current device, sending a communication connection message indicating that the current device is capable of receiving data from the data migration originating device; and receiving data after establishing a communication connection with the data migration originating device.

[0006] According to another aspect of this disclosure, an apparatus for migrating data is provided, the apparatus comprising: a first module configured to: display candidate devices for migratable data, and determine the target device from the candidate devices in response to an operation of selecting a target device for migrating data; a second module configured to: send a control message to each device corresponding to the account to which the data belongs, the control message indicating device discovery information related to the data migration object; a third module configured to: broadcast a communication request message indicating information of a communication interface of the data's originating device, the communication interface being used for data transmission; a fourth module configured to: receive a communication connection message from the target device, the communication connection message indicating that the target device is capable of receiving data; and a fifth module configured to: migrate the data to the target device after establishing a communication connection with the target device of the data.

[0007] According to another aspect of this disclosure, an apparatus for migrating data is provided, the apparatus comprising: a first module configured to: receive a control message indicating device discovery information relating to a data migration object; a second module configured to: receive a communication request message indicating information about a communication interface of the data migration originating device, the communication interface being used for data transmission; a third module configured to: send a communication connection message in response to a data migration object in the control message matching a current device, the communication connection message indicating that the current device is capable of receiving data from the data migration originating device; and a fourth module configured to: receive data after establishing a communication connection with the data migration originating device.

[0008] According to another aspect of this disclosure, an electronic device is also provided, comprising: a processor; and a memory having a computer program stored thereon, which, when executed by the processor, causes the processor to perform the steps of the data migration method as described above.

[0009] According to another aspect of this disclosure, a computer-readable storage medium is also provided, storing a computer program that, when executed by a processor, causes the processor to perform the steps of the data migration method described above.

[0010] According to another aspect of this disclosure, a computer program product is also provided, including a computer program that, when executed by a processor, implements the steps of the data migration method described above.

[0011] The embodiments of this disclosure, through control messages, communication request messages, and communication connection information, enable communication and data migration between devices using different platforms while ensuring data security, thereby improving cross-platform compatibility and flexibility. Compared to traditional QR code scanning, the embodiments of this disclosure, by displaying candidate devices for data migration and allowing users to select the target device for data migration, enable users to conveniently select the target device and optimize the operation process. Attached Figure Description

[0012] To more clearly illustrate the technical solutions in the embodiments of this disclosure, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this disclosure. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0013] Figure 1 A schematic diagram of an application scenario according to an embodiment of this disclosure is shown.

[0014] Figure 2 An interface diagram of a data migration method according to an embodiment of the present disclosure is shown.

[0015] Figure 3 Another interface diagram of a data migration method according to an embodiment of this disclosure is shown.

[0016] Figure 4 Another interface diagram of a data migration method according to an embodiment of this disclosure is shown.

[0017] Figure 5 An example of a page corresponding to the device discovery and connection process in the data migration process according to an embodiment of this disclosure is shown.

[0018] Figure 6 An example of data transfer and a corresponding page showing the completion of data transfer during a data migration process according to an embodiment of this disclosure is shown.

[0019] Figure 7 An example of a page corresponding to a data transfer error during a data migration process according to an embodiment of this disclosure is shown.

[0020] Figure 8 Examples of fault pages during data migration according to embodiments of this disclosure.

[0021] Figure 9 Another example of a fault page during a data migration process according to an embodiment of this disclosure is shown.

[0022] Figure 10 A flowchart illustrating a data migration method according to an embodiment of this disclosure is shown.

[0023] Figure 11A An example of control information relating to device discovery information related to a data migration object, according to an embodiment of this disclosure, is shown.

[0024] Figure 11B Another schematic flowchart of a data migration method according to an embodiment of the present disclosure is shown.

[0025] Figure 11C The encapsulation structure of data according to an embodiment of this disclosure is shown.

[0026] Figure 12 Another schematic diagram of a data migration method according to an embodiment of the present disclosure is shown.

[0027] Figure 13 A flowchart illustrating a data migration method according to an embodiment of this disclosure is shown.

[0028] Figure 14 Another schematic diagram of a data migration method according to an embodiment of the present disclosure is shown.

[0029] Figure 15 A structural block diagram of a data migration device according to an embodiment of the present disclosure is shown.

[0030] Figure 16 A structural block diagram of an apparatus for data transfer according to an embodiment of the present disclosure is shown.

[0031] Figure 17 A structural block diagram of an apparatus according to an embodiment of the present disclosure is shown.

[0032] Figure 18 A schematic block diagram of an electronic device according to an embodiment of the present disclosure is shown.

[0033] Figure 19 A schematic diagram of a storage medium according to the present disclosure is shown. Detailed Implementation

[0034] To make the objectives, technical solutions, and advantages of this disclosure more apparent, exemplary embodiments according to this disclosure will now be described in detail with reference to the accompanying drawings. Obviously, the described embodiments are merely some embodiments of this disclosure, and not all embodiments of this disclosure. It should be understood that this disclosure is not limited to the exemplary embodiments described herein.

[0035] In this specification and accompanying drawings, steps and elements that are substantially the same or similar are indicated by the same or similar reference numerals, and repeated descriptions of these steps and elements are omitted. Furthermore, in the description of this disclosure, the terms "first," "second," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance or order.

[0036] First, a brief explanation of the various terms used in this disclosure will be provided.

[0037] Application Programming Interface (API): An API is a set of predefined functions that allow different software applications or components to interact. An API defines how software components communicate with each other, including data formats, request and response rules, etc. APIs can be local or network-based. APIs enable developers to use specific functionalities without needing to understand the underlying implementation details.

[0038] User Interface (UI): The UI is the interface between humans and computer systems, encompassing all elements that users can interact with, such as buttons, menus, windows, and icons. The goal of UI design is to improve user convenience and experience. A Graphical User Interface (GUI) is a type of UI that uses graphical elements to provide a more intuitive and user-friendly interaction method.

[0039] Cross-platform operation: Cross-platform operation refers to the ability of software to run on different operating systems without having to write separate code for each platform. This capability is achieved by using cross-platform development tools or frameworks, which allow developers to write code once and then run it on multiple platforms such as iOS, Android, Windows, and macOS through a specific compilation process, thereby saving development time and costs.

[0040] Common Gateway Interface (CGI): CGI is a communication protocol used between web servers and applications. It defines how a web server forwards client requests to a backend application and returns the application's response to the client. CGI enables web servers to run external scripts or programs to generate dynamic web page content.

[0041] Local Area Network (LAN): A LAN is a group of computers and other devices connected via wired or wireless networks within a limited geographical area, such as a home, office, or school. LANs allow users to share resources, such as printers and file storage, while providing high-speed data transfer and communication. LANs are typically used for communication and resource sharing within an organization to improve productivity and collaboration.

[0042] Router: A router is a network layer device that plays a crucial role in network communication. Its primary function is to transmit data packets from one network to another, which typically involves handling different network protocols and selecting data paths. Routers use routing tables to determine the optimal transmission path for data packets, thereby enabling interconnection between different networks or subnets. Furthermore, routers often possess firewall functionality, providing network security and data filtering services.

[0043] Switch: A switch is a network device in a local area network (LAN) used to connect multiple devices and exchange data. Switches operate at the data link layer, responsible for receiving data packets from a device on the network and forwarding them to the correct destination based on the MAC address information in the data packet. Switches can reduce network congestion, improve data transmission efficiency, and enhance network security through Virtual Local Area Network (VLAN) technology.

[0044] Java Native Interface (JNI) is a mechanism provided by the Java platform that allows Java code to interact with native code written in other languages ​​(usually C or C++). This mechanism enables Java programs to leverage native code to perform performance-sensitive tasks or access platform-specific functionalities. JNI provides a way for Java applications to call functions in native libraries, enabling direct access to the underlying system.

[0045] A database is a long-term, organized collection of data that allows users to access and manage data through predefined operations. Databases are typically managed by a Database Management System (DBMS), which provides interfaces for creating, querying, updating, and deleting data. Databases can be relational, such as MySQL and PostgreSQL, which use tables and relationships to organize data; or non-relational, such as MongoDB and Cassandra, which offer more flexible data models. Database design aims to improve data consistency, integrity, and security, while providing efficient data retrieval capabilities.

[0046] SQLite is a lightweight relational database management system (RDBMS) renowned for its simplicity and efficiency. Because SQLite exists as a library, it doesn't require a separate server process like traditional database systems, making it ideal for resource-constrained environments. The SQLite database is a single file, simplifying data storage and access, and its self-contained nature eliminates the need for complex installation and configuration. SQLite is widely used in mobile applications, desktop applications, small to medium-sized server applications, and embedded systems. It supports standard SQL syntax, enabling developers to easily implement complex database operations.

[0047] Message Loop: The message loop is a concept in many application architectures, especially in graphical user interface (GUI) programming. Within the message loop, the application continuously checks for new events or messages that need to be processed. These events may originate from user interactions, such as mouse clicks or keyboard input, or they may come from the system or other applications. When the message loop detects an event, it interrupts its waiting state, calls the appropriate event handler function, and then returns to the loop to continue waiting. This mechanism allows applications to respond to user input and system notifications while maintaining a smooth and responsive interface.

[0048] A thread is the smallest unit of computation that an operating system can schedule; it is contained within a process. Each thread has its own stack and registers, but shares the code, global variables, and resources of its parent process. Multithreaded programming allows multiple tasks to be executed in parallel within a single process, which can improve application responsiveness and performance. Switching between threads is much faster than switching between processes because threads share the same memory space and do not require context switching. However, because multiple threads share the same memory space, this also introduces synchronization and data consistency issues, which need to be addressed through appropriate synchronization mechanisms. Threads can execute truly in parallel on multi-core processors, making full use of hardware resources and improving computational efficiency.

[0049] C++: C++ is a powerful, general-purpose programming language that inherits the efficiency and flexibility of C and introduces object-oriented programming (OOP) concepts such as classes, inheritance, polymorphism, and encapsulation. C++'s design philosophy emphasizes performance and resource management control, making it ideal for high-performance computing and resource-intensive applications. C++ supports multiple programming paradigms, including procedural programming, object-oriented programming, and generic programming. Its efficiency is reflected in near-hardware-level operations and optimized compiler technology, while its flexibility is reflected in its wide range of applications, including but not limited to operating systems, browsers, game engines, high-performance servers, embedded systems, and scientific computing.

[0050] Protocol Buffers (PB) is a flexible and efficient data description language used for data serialization and deserialization. PB defines a language-independent way to describe data structures, enabling data serialized using PB to be transmitted and parsed across different programming languages. PB's binary format is more compact and faster to parse than text formats like XML or JSON, making it ideal for network communication and data storage. PB also supports backward and forward compatibility, allowing developers to update data structures without breaking existing systems.

[0051] Serialization: Serialization is the process in computer science of converting complex data structures into a sequence of bytes, allowing data to be stored in files or transmitted over networks. Serialization is a key technology in distributed systems and persistent storage. During serialization, the state information of an object is encoded into a series of bytes, which can be written to disk, sent over a network, or stored in other ways. When the object needs to be recovered, these byte sequences can be deserialized back to the original data structure. Serialization mechanisms must consider data consistency, compatibility, and efficiency.

[0052] Byte stream: A byte stream is a data structure used in computer programming to represent a continuous sequence of bytes. It provides a mechanism that allows programs to read and write data in binary form. Byte streams can be used to process any type of data because all data can ultimately be represented as a sequence of bytes. In I / O operations, byte streams allow data to be transferred in the smallest unit (byte), making them ideal for handling large files or binary data. The use of byte streams simplifies data reading and writing operations, improving program efficiency and flexibility.

[0053] Reference Figure 1 This document describes application scenarios of the methods and corresponding apparatuses according to embodiments of the present disclosure. Figure 1 A schematic diagram of an application scenario 100 according to an embodiment of the present disclosure is shown, wherein a server 110 and a plurality of terminals 120 are schematically illustrated.

[0054] This disclosure relates to a method or apparatus for data migration. The following description uses chat history migration in an instant messaging application as an example scenario. However, the method of this disclosure is not limited to chat history migration. In fact, the method of this disclosure can be applied to various types of data migration scenarios. For example, the data involved in the embodiments of this disclosure includes, but is not limited to: user personal information, media files (such as pictures, videos, and audio), application settings, document files, schedules, favorites, and other data types.

[0055] As an example, the instant messaging application of this disclosure embodiment can be integrated into various electronic devices, for example, Figure 1 The diagram shows multiple terminals 120. Terminal 120 can be a mobile phone, tablet computer, laptop computer, desktop computer, personal computer (PC), smart speaker, or smartwatch, but is not limited to these.

[0056] Instant Messenger is an internet-based online chat tool that allows users to communicate with each other in real time via text, voice, and video. To ensure communication quality and security, when a user activates the instant messaging application through their terminal 120, chat messages are transmitted and encrypted via server 110. However, server 110 does not store any chat messages, nor does it provide them to any third party. Once chat messages are successfully sent or received, server 110 immediately deletes them.

[0057] Generally speaking, chat logs exist only locally on the user's device and are not uploaded to the cloud or shared with third parties. Specifically, chat logs are records of information generated during electronic communication using instant messaging applications, including various forms such as text, images, videos, and audio. They typically consist of elements such as timestamps, participant information, message content, message status, interactive actions, contextual information, attachments and media, and metadata.

[0058] There are various scenarios that may necessitate the migration of chat logs, including but not limited to: device replacement, system upgrades, data backup, privacy protection, multi-device use, legal and compliance requirements, and improving user experience. Chat log migration is an important data management process that allows users to seamlessly transfer communication records from one device or platform to another. This process involves copying, synchronizing, or transferring data to ensure that users can access historical communication content on new devices while maintaining the integrity and continuity of information.

[0059] Enterprises often have higher requirements for migrating chat logs across multiple platforms due to the nature of their instant messaging software. This is because enterprise communications frequently involve sensitive information and critical business data, necessitating assurance of information security, continuity, and accessibility. In an enterprise environment, employees may need to switch between different devices and operating systems, such as from desktop computers to mobile devices, or use different network environments while traveling. Chat log migration not only ensures the integrity and consistency of information but also supports flexible employee work styles while meeting enterprise requirements for data management and compliance. Furthermore, cross-platform chat log migration helps improve team collaboration efficiency, ensuring all members have real-time access to the latest communication records, enabling quick and accurate decision-making.

[0060] However, the chat history migration functionality of current instant messaging applications has significant technical limitations. Currently, most applications only support chat history migration between mobile devices, a process typically requiring QR code scanning and relying on a local area network (LAN) connection. After the sending device generates a QR code, the receiving device scans it to obtain the necessary information and establish a connection. Subsequently, the sending device transmits the chat history data to the receiving device, overwriting the original data.

[0061] This migration method is relatively complex in terms of operation procedures, and requires that the incoming and outgoing equipment use the same platform, which brings inconvenience to users and poses certain security risks.

[0062] For example, during the migration process, once data transfer (such as the transfer of chat logs) is completed, the device being migrated will be forced to log out. This not only affects the user experience but may also cause data loss or inconsistency.

[0063] Furthermore, this method requires that the incoming and outgoing devices use the same platform. There is a lack of effective chat history migration mechanisms between mobile and desktop clients, and desktop clients typically do not support chat history migration, which limits users' ability to synchronize chat history across different devices.

[0064] QR code scanning can also easily lead to data overwriting issues during chat history migration. Current technologies typically use an overwriting method, where the chat history from the originating device replaces the existing records on the receiving device. This makes it impossible to merge and synchronize chat history. The inability to effectively integrate chat history across different devices causes inconvenience for users, especially when switching between multiple devices.

[0065] To this end, this disclosure provides a data migration method, the method comprising: displaying candidate devices for migratable data, and determining the target device from the candidate devices in response to an operation of selecting a target device for migrating the data; sending a control message to each device corresponding to the account to which the data belongs, the control message indicating device discovery information related to the data migration object; broadcasting a communication request message indicating information of the communication interface of the data's originating device, the communication interface being used for data transmission; receiving a communication connection message from the target device, the communication connection message indicating that the target device is capable of receiving data; and migrating the data to the target device after establishing a communication connection with the target device of the data.

[0066] This disclosure provides a method for migrating data, comprising: receiving a control message indicating device discovery information related to a data migration object; receiving a communication request message indicating information about a communication interface of the data migration originating device, the communication interface being used for data transmission; in response to a data migration object in the control message matching a current device, sending a communication connection message indicating that the current device is capable of receiving data from the data migration originating device; and receiving data after establishing a communication connection with the data migration originating device.

[0067] The embodiments of this disclosure, through control messages, communication request messages, and communication connection information, enable communication and data migration between devices using different platforms while ensuring data security, thereby improving cross-platform compatibility and flexibility. Compared to traditional QR code scanning, the embodiments of this disclosure, by displaying candidate devices for data migration and allowing users to select the target device for data migration, enable users to conveniently select the target device and optimize the operation process.

[0068] In addition, alternatively, embodiments of this disclosure can support the migration of chat logs across multiple platforms by serializing the transmitted data, allowing users to easily synchronize message backups across different devices, whether they are using a personal computer, laptop, or smartphone.

[0069] In addition, this disclosure optionally supports the function of merging chat history, which means that during the migration process, chat history from different times and on different devices can be integrated together to provide users with a coherent chat history.

[0070] Figure 2 An interface diagram of a data migration method according to an embodiment of the present disclosure is shown. Figure 2 The interface diagram shown illustrates the device discovery process in a data migration method according to an embodiment of this disclosure.

[0071] likeFigure 2 As shown, after a user triggers the chat history migration function, the instant messaging application displays... Figure 2 The left image shows the primary page. This primary page provides an intuitive device type selection interface. The device selection area uses radio button groups, each accompanied by the text "Migrate to Phone" and "Migrate to Another Computer." Different notes are provided for these two different chat history migration methods. For example, the "Migrate to Phone" function should inform the user that this migration solution migrates chat history from the current device to another mobile terminal via a local area network (LAN). This process directly transfers chat history over the LAN, therefore requiring both mobile terminals to be on the same LAN. Similarly, the "Migrate to Another Computer" function should inform the user that this migration solution migrates chat history from the current device to another computer via a LAN, also a process that directly transfers chat history over the LAN.

[0072] Users select the device type they wish to migrate data from by clicking radio buttons representing mobile or desktop devices. Once selected, users are allowed to proceed to the next step, the device selection page (level 2). At this point, the instant messaging device will be displayed on the level 2 page.

[0073] The secondary page displays all logged-in devices in a clear list view. Each list item includes not only device type information (MAC or Windows) but also device identification information, such as a unique identifier, which helps users accurately identify the target device. The list items are designed so that users can select specific devices by clicking. After confirming the selection, users can complete the operation by clicking the "OK" button on the page.

[0074] Compared with traditional solutions, the chat history migration interface according to the embodiments of this disclosure does not require scanning a QR code to support the discovery of transferable devices, which greatly improves the flexibility and user-friendliness of the chat history migration solution.

[0075] Figure 3 Another interface diagram of a data migration method according to an embodiment of this disclosure is shown. Figure 3 The interface diagram shown illustrates an example of selecting to migrate all chat records or migrate a portion of chat records during the chat history migration process according to an embodiment of this disclosure.

[0076] Once the migration process begins, the instant messaging application interface will display basic information about the originating company, including its name and other key details, to ensure the user is operating the correct company account. Following this is a display of the size of the data to be migrated, providing users with a data overview and helping them understand the scale and duration of the migration operation.

[0077] The user interface offers two options: migrate all chat history or migrate only a portion of chat history. These options are typically presented as buttons and labeled "Migrate All" and "Migrate Only Specified Chat History" so users can choose according to their needs.

[0078] For most users enabling a new device, migrating all chat history is likely a more suitable option. This ensures users can seamlessly continue their previous communications and workflows. If a user selects "Migrate All Chat History," the instant messaging application will display as follows: Figures 5 to 7 The data transfer page shown is described in detail later.

[0079] However, if users need to back up their data between two devices, or only want to retain important information, they can choose the "Migrate only specified chat history" option. If a user clicks the "Migrate only specified chat history" option, the instant messaging application will display something like this: Figure 4 The second-level page is shown.

[0080] Figure 4 Another interface diagram of a data migration method according to an embodiment of this disclosure is shown. Figure 4 The interface diagram shown illustrates an example of selecting a portion of chat history to migrate in a data migration method according to an embodiment of this disclosure.

[0081] like Figure 4 As shown, in order to enable users to quickly find the chat history they need to migrate when they have a large number of chat sessions, the interface according to the embodiments of this disclosure can provide a variety of session filtering functions.

[0082] Specifically, such as Figure 4 As shown in the top left image, the interface has a title area at the top displaying the title "Select Chat History". Below the title area is a filter area containing three filter controls, indicating the filter dimensions: time range, chat type, and chat history type. Below the filter controls is a dynamically generated list of conversations, where each conversation item is identified by the participants and the size of the corresponding chat history. Users can select specific chat history by checking the checkboxes next to each conversation. A "Select All / Deselect" button may also be included next to the list, allowing users to quickly select or deselect all conversations.

[0083] like Figure 4 As shown in the upper right image, when a user selects to filter chat history by time, a drop-down menu is provided under the time range filter control, offering "Within 3 Months," "Within 6 Months," "Within 1 Year," and "All" options, allowing users to quickly filter by time span. The conversation list will also dynamically change after the user clicks on one of the options.

[0084] like Figure 4 As shown in the lower left image, when a user selects to filter chat history by chat type, a drop-down menu is provided under the chat type filter control, listing options such as "Internal One-on-One Chat", "Internal Group Chat", "External One-on-One Chat", and "External Group Chat", allowing the user to select based on the nature of the members participating in the conversation.

[0085] like Figure 4 As shown in the lower right image, when a user selects to filter chat history by chat history type, the filter control for chat history type is a checkbox group, allowing the user to select "all chat types" or exclude "images", "videos", and "files" to retain only text messages, thereby reducing the amount of data to be migrated.

[0086] Considering that chat logs can reach tens of gigabytes in size, mostly consisting of images, videos, and files, the interface according to embodiments of this disclosure provides options for filtering this media content. This allows users to choose to migrate only chat logs containing text, thereby reducing device space usage, shortening migration time, and lowering migration costs. This flexibility not only improves the efficiency of the migration process but also provides users with more control, enabling them to customize the migration content according to their specific needs. After selecting the chat logs to be migrated, the following will be displayed: Figures 5 to 7 The data transfer page shown.

[0087] Figures 5 to 7 An interface diagram of a data migration method according to an embodiment of the present disclosure is shown. Figure 5 The interface diagram shown illustrates an example of a page corresponding to the device discovery and connection process in the data migration method according to an embodiment of this disclosure. Figure 6 The interface diagram shown illustrates an example of data transmission and a corresponding page for data transmission completion in a data migration method according to an embodiment of this disclosure. Figure 7 The interface diagram shown illustrates an example of a page corresponding to a data transmission error in a data migration method according to an embodiment of this disclosure.

[0088] Figure 5 The interface displays the device discovery and connection phases during the chat history migration process. The interface shows a "Connecting" status and provides a "Cancel" control for users to terminate the operation. During the transfer process, various abnormal situations may occur, such as no other logged-in devices being found during device discovery, insufficient storage space on the receiving end, or the user manually terminating the migration process. For these situations, embodiments of this disclosure can provide clear and explicit prompts to the user to ensure that the user understands the current status and takes appropriate action when necessary.

[0089] Figure 6The interface demonstrates the chat history migration process, providing users with detailed progress information and controllable information. The top of the interface displays a "Migrifying" status to indicate the current operation. A progress bar is displayed in the central area, visually showing the chat history migration progress. Below the progress bar, the real-time transmission speed (e.g., "2MB / s") or estimated remaining time (e.g., "Estimated 10 minutes remaining") is displayed to provide users with precise progress indicators. A "End Migration" button is located at the bottom of the interface, allowing users to terminate the operation if necessary. Above the button, an important notice is displayed: "To ensure a smooth migration, please keep the sending end open and on the same network as the receiving end." To enable users to quickly obtain the information they need, the interface may also include animation effects, such as smooth progress bar movement or real-time updates of the transmission speed, enhancing the user experience.

[0090] Figure 7 The screen displays a success message after the chat history migration is complete, marking the end of the entire migration process. Figure 7 The interface shown conveys the message that the migration is complete and guides the user through the final steps. Figure 7 A text box prompting "Migration complete" guides the user to click and end the migration process. The migration of the entire chat history ends when the user clicks the "Complete" button.

[0091] exist Figures 5 to 7 Throughout the entire migration process, user guidance and operation protection information will be displayed. For example, continuous prompts such as "Do not lock the screen or close the window to ensure a smooth migration" can be displayed to prevent accidental interruption. To further protect the migration process, if the user attempts to close the window, a secondary confirmation dialog box will pop up, clearly explaining the potential consequences of closing the window and asking the user if they are sure they want to interrupt the migration. Additionally, measures may be taken to prevent the device from automatically locking the screen, such as keeping the screen constantly on or periodically reminding the user to remain active. These design elements collectively ensure the smooth completion of the migration process while minimizing the risk of user error.

[0092] Figures 8 to 9 Another interface diagram of a data migration method according to an embodiment of this disclosure is shown. Figure 8 The interface diagram shown illustrates an example of a fault page in a data migration method according to an embodiment of this disclosure. Figure 9 The interface diagram shown illustrates yet another example of a fault page in a data migration method according to an embodiment of this disclosure.

[0093] Figure 8The main part of the interface may include prompts such as "No migrated device found," and a guiding message: "Please log in on the originating device and connect to the same network." A "Back" button is located at the bottom of the interface. This button allows the user to return to the previous interface or the starting page of the migration process, providing the option to restart or adjust settings.

[0094] Similarly, Figure 9 The main part of the interface shown may include prompts such as "Insufficient phone space," and a guidance message: "Migration requires up to 12.3GB of space. Continuing the migration may result in insufficient space on your current phone." A "OK" button is located at the bottom of the interface. This button allows users to return to the previous interface or the starting page of the migration process, providing them with the option to restart or adjust settings.

[0095] like Figures 2 to 9 As shown, the chat history migration solution of this disclosure provides cross-platform compatibility and flexibility. The embodiments of this disclosure support seamless migration of chat history across the four major operating system platforms: Windows, macOS, Android, and iOS. This multi-platform support allows users to easily synchronize message backups across different devices, whether they are using a PC, laptop, or smartphone. Furthermore, the embodiments of this disclosure also support the function of merging chat history, meaning that during the migration process, chat history from different points in time and on different devices can be integrated together, providing users with a coherent chat history.

[0096] The following combination Figures 10 to 16 The data migration method disclosed herein is described in detail.

[0097] Figure 10 A flowchart illustrating a data migration method 1000 according to an embodiment of the present disclosure is shown. Figure 11A An example of control information relating to device discovery information related to a data migration object, according to an embodiment of this disclosure, is shown. Figure 11B Another schematic flowchart of a data migration method 1000 according to an embodiment of the present disclosure is shown. Figure 11C The encapsulation structure of data according to an embodiment of this disclosure is shown.

[0098] Method 1000 can be executed by the data source device, that is, by the chat history source device. In the chat history migration process, the source device refers to the communication device or platform responsible for providing the chat history data. The source device can be a variety of terminals, including but not limited to smartphones, tablets, and personal computers. The destination device is the receiving end of the chat history migration, possessing the ability to receive, parse, and store chat history from the source device. Similar to the source device, the destination device can also be a variety of terminal devices, which may be equipped with different or the same software or communication platform as the destination device, as long as it can effectively synchronize data with the source device. Optionally, embodiments of this disclosure can restrict the destination device to be located in the same local area network environment to utilize high-speed and generally more secure internal network connections to optimize data transmission efficiency.

[0099] like Figure 10 As shown, in step S1010, candidate devices for migratable data are displayed, and in response to the operation of selecting a target device for the data to be migrated, the target device is determined from the candidate devices.

[0100] like Figure 11B As shown, in the chat history migration process, the sending device is responsible for initiating the device discovery mechanism. For example, determining the target device from the candidate devices includes: sending a search request with filtering parameters to the backend server based on the operation that triggers the data migration function, so that the backend server retrieves device information that matches the filtering parameters and is logged in using the account to which the data belongs; receiving the search results from the backend server, and displaying the device information that matches the filtering parameters based on the search results; and receiving information for selecting and confirming the target device for the data.

[0101] For example, a user can trigger the chat history migration function on a primary page. The sending device can send a search request with filtering parameters to the backend server, enabling the backend server to retrieve device information matching the filtering parameters and logged in using the account associated with the chat history. The sending device can then receive the search results from the backend server and display the device information matching the filtering parameters on a secondary page based on the search results. The sending device then receives information about the receiving device for selecting and confirming the chat history migration based on the user's choice. Of course, this disclosure is not limited to this.

[0102] Optionally, in this example, when the user... Figure 2After the chat history migration function is triggered on the first-level page, the device from which the chat history is being migrated will communicate with the backend server to retrieve information on all devices logged in using the same account. This information includes device type, device name, system version, etc. This information is reported to the backend server when the device first logs in for subsequent identification and selection. During this process, the backend server is responsible for maintaining the account login status, processing retrieval requests from the migrated device, and ensuring that the information provided to the user through the retrieval results is accurate and up-to-date. After the backend server provides this information to the migrated device, the migrated device parses the information and displays the second page.

[0103] Optionally, such as Figure 2 As shown, the primary page allows users to choose between "Migrate to Mobile" and "Migrate to Another Computer." Correspondingly, the device retrieval request sent to the backend server should provide filtering parameters, such as device type and login status, to ensure that only devices matching the user's selection are retrieved. These parameters help the backend server accurately locate and return a list of active, matching devices under the current account. Based on the device list returned by the backend server, the corresponding devices can be displayed on the secondary page, including information such as device name, model, and operating system version, allowing users to intuitively identify and select the target migration device. Furthermore, after the user clicks the "Confirm" button, they can confirm the selected device for migrating chat history. Thus, the migrating device receives information used to select and confirm the migration of chat history.

[0104] In step S1020, a control message is sent to each device corresponding to the account to which the data belongs. The control message indicates device discovery information related to the data migration object.

[0105] In the chat history migration process, once the user identifies the receiving device, the sending device initiates the sending of a control message. This control message indicates device discovery information related to the chat history migration target. This control message can be implicitly sent to all devices under the current account through existing messaging channels in the instant messaging system, but is not directly displayed to the user. The control message contains identification information for the two devices undergoing the chat history migration, establishing a pre-defined communication protocol between the devices to ensure stability and continuity during the migration process, thereby reducing the risk of interruption due to communication problems.

[0106] It's worth noting that the messaging channel can be carried over the public internet. The public internet, also known as a wide area network (WAN), is a computer network covering a vast geographical area, allowing user devices in different geographical locations to receive control messages. For example, in a company setting, even if the chat history migration occurs between two devices within the company, the account device located in a remote home environment can still receive the control message. This design ensures that regardless of the user's device location, they can receive timely notifications and information about the chat history migration, thereby improving the flexibility of the entire migration process and the convenience of user operation.

[0107] This control message allows the sending device to notify other devices within the account in advance of the upcoming migration, and the target device to know that the user has selected it as the destination device (target device) for chat logs on the sending device. This ensures that when actual data transmission begins, the destination device is ready to receive the data, while other devices can identify and ignore this data, avoiding unnecessary processing or interference. Furthermore, the control message helps to quickly locate and resolve potential problems during the migration process, ensuring a smooth chat log migration while protecting the integrity and privacy of user data.

[0108] Subsequently, the sending device attempts to establish a local area network connection with the identified chat log receiving device. Before data transmission begins, both devices need to perform a series of data interactions. This process includes steps S1030 to S1050, which will be detailed later.

[0109] In step S1030, a communication request message is broadcast, which indicates information about the communication interface of the data transfer device, the communication interface being used to transmit data.

[0110] In scenarios where chat logs are used as data, the communication request message indicates information about the communication interface of the device receiving the chat logs, and the communication interface is used to transmit the chat logs. Of course, this disclosure is not limited to this.

[0111] Optionally, during the chat history migration process, the sending device can broadcast a communication request message within the local area network (LAN) to inform the receiving device on the LAN how to find and connect to the sending device's communication interface. The communication request message is designed to efficiently transmit the communication interface information required by the receiving device, ensuring smooth transmission of chat history data. Leveraging the efficiency and closed nature of the LAN, the sending device can quickly inform the receiving device of its communication interface information. In this way, the communication request message can propagate directly between devices within the LAN without relying on external network services, reducing dependence on external networks and potential latency, and improving the response speed and reliability of the migration process.

[0112] likeFigure 11A As shown, the structure of a communication request message consists of two main parts: a header field and a data field. The header, identified by "LAN discovery," clearly indicates the message's purpose: a device discovery request within a local area network. The data section contains key fields such as device type, device ID, IP address, and port number. These fields are essential for chat logging; they are encoded using fixed-length byte sequences (uint32) to ensure data consistency and parsability, while also guaranteeing message compatibility across different devices and systems.

[0113] In step S1040, a communication connection message from the target device is received, the communication connection message indicating that the target device is capable of receiving data.

[0114] Optionally, the sending device can receive a communication connection message from the receiving device of the chat history, the communication connection message indicating that the receiving device of the chat history can receive the chat history from the sending device. Of course, this disclosure is not limited thereto.

[0115] Optionally, the communication connection message indicates that the incoming device has the capability to receive chat logs from the outgoing device. Specifically, the incoming device will attempt to establish a TCP connection within the local area network based on the previous communication request message. TCP is a stable and reliable network communication protocol suitable for application scenarios that require ensuring data integrity and order.

[0116] For example, after successfully establishing a TCP connection, the receiving device can send a "TCP_ready" command to the sending device, indicating that it is ready to receive data. Upon receiving the "TCP_ready" signal, the receiving device will begin transmitting chat log data as scheduled. During data transmission, the sending device will monitor the transmission status to ensure the accuracy and integrity of the data and take measures such as retransmission when necessary.

[0117] In step S1050, after establishing a communication connection with the target device for the data, the data is migrated to the target device. This migration includes executing a data extraction thread, a serialization thread, and a data sending thread in parallel. The data extraction thread extracts a portion of the data from the database of the originating device, the serialization thread serializes the extracted data, and the data sending thread sends the serialized data to the target device. This disclosure is not limited to these steps.

[0118] Optionally, in step S1050, after establishing a communication connection with the receiving device of the chat records, the sending device can execute a data extraction thread, a serialization thread, and a data sending thread in parallel. The data extraction thread is used to extract a portion of the chat records from the database of the sending device, the serialization thread is used to serialize the portion of the chat records, and the data sending thread is used to send the serialized portion of the chat records to the receiving device of the chat records.

[0119] Optionally, once a stable TCP connection is established between the sending and receiving devices within the same local area network, the sending device initiates a data extraction thread. This thread can selectively read portions of chat logs from the local chat history database, based on time sequence or other logical order. For example, the data extraction thread can first extract a predetermined number of conversation text messages from the database, and then extract attachment messages from the conversations from the database.

[0120] When the device being migrated is a mobile device, SQLite databases are typically used to store chat logs. SQLite databases are a suitable solution for storing chat logs due to their lightweight nature and ease of integration. The chat logs retrieved by the data extraction thread are then temporarily stored in a cache, preparing for the next step of the serialization thread. This avoids the memory pressure and potential performance issues caused by loading all chat logs at once, instead employing a batch-based, partial strategy, thereby optimizing memory usage and processing speed.

[0121] In this way, the data extraction thread and the serialization thread work together to ensure the orderly processing and transmission of data. The data extraction thread is responsible for managing and controlling the data flow, while the serialization thread focuses on serializing the relevant chat logs. This phased processing approach not only improves the flexibility and responsiveness of data processing but also enables the instant messaging application to maintain high stability and reliability when migrating large amounts of chat logs. Furthermore, the batch processing strategy allows the system to quickly recover and continue the migration process in the event of network fluctuations or other temporary problems, reducing data retransmissions and time losses due to errors, thereby improving overall migration efficiency and user experience.

[0122] The serialization thread is used to serialize the chat logs, effectively organizing and transforming the data extracted by the data extraction thread to facilitate data transmission by the subsequent data sending thread. For example, the serialization thread can serialize data according to a predefined Protocol Buffers (PB) structure. PB, as a language-independent, platform-independent, and highly scalable serialization framework, greatly facilitates communication between different systems. By mapping chat logs to a clear, self-describing format, it not only simplifies the data serialization process but also ensures that the serialized data can be seamlessly transmitted and parsed across different programming environments and platforms. Leveraging these advantages of PB, the serialization thread ensures the integrity and consistency of chat logs during migration, while improving the efficiency and reliability of data exchange.

[0123] Optionally, the serialization thread can encapsulate different types of chat logs, including plain text messages, file messages, and control messages, into a unified data structure defined by PowerBuilder (PB). As an efficient data serialization tool, PB assigns a unique identifier to each message type and encapsulates necessary metadata, such as type identifier, data length, and number of data items, in each PB message. This encapsulation method not only ensures data integrity and consistency but also improves data identifiability, enabling the receiver to accurately parse and understand the received information.

[0124] like Figure 11C As shown, to ensure correct data transmission and reception at the network layer, both the sending and receiving devices employ a TLV (Type-Length-Value) structure to further encapsulate the PB serialized data into data packets. The TLV structure is a standardized data exchange format that uses a message type field (Type field) to specify whether the message is a control or data message, a message length field (Length field) to indicate the data length, and a message content field (Value field) to carry the actual data content. The sending device's network layer, based on the message type (whether control or data), fills in the appropriate value in the Type field, the data length in the Length field, and places the serialized data in the Value field. Subsequently, the encapsulated TLV data units are transmitted over the network, ensuring the data remains structurally clear and easily parsed during transmission, thus enabling accurate reconstruction of the original chat log data at the receiving device.

[0125] Optionally, data packets encapsulated in TLV format are securely delivered to an established local area network TCP connection via a data sending thread for efficient transmission. The coordinated work of the data extraction thread, serialization thread, and data sending thread ensures that data is smoothly transmitted from the originating device to the destination device in a predetermined order and format. To achieve efficient data transmission while ensuring that other functions of the instant messaging application are not affected, embodiments of this disclosure employ a multi-threaded processing mechanism. The data sending thread works in parallel with other threads of the application without interference, ensuring the application's responsiveness and concurrency performance.

[0126] In the embodiments of this disclosure, the use of multithreading allows the instant messaging application to avoid monopolizing the database thread or I / O thread when reading chat history, processing file content, and performing other I / O operations. This avoids performance bottlenecks under high load and improves the overall throughput of the instant messaging application. Through a message loop mechanism, each thread can respond to events and requests from other threads, achieving lock-free programming and reducing the risk of thread race conditions and deadlocks. Within a thread, messages are processed in a first-in, first-out (FIFO) order, ensuring the sequentiality and consistency of data processing. This message-passing-based communication mechanism not only improves the efficiency of inter-thread collaboration but also simplifies the complexity of multithreaded programming, making the entire chat history migration process more stable and reliable.

[0127] Therefore, the chat history migration method of this disclosure optimizes the discovery and connection process between the migration-in device and the migration-out device. Through a message sending mechanism, control information and communication request information are transmitted to the target migration-in device, enabling the migration-in device to automatically identify and establish a connection with the migration-out device, and automatically initiate the migration process. This automated connection mechanism reduces the complexity of user operations, speeds up the migration process, and improves overall efficiency.

[0128] Furthermore, the chat history migration method of the embodiments of this disclosure also supports a use-while-migrating mode, improving the user experience. Even when processing large amounts of data migration, users do not need to interrupt their work or wait for the migration to complete. This background migration mechanism allows users to continue using the instant messaging application for work and other activities during the migration process, thereby minimizing the impact of the migration operation on the user's daily work. Through the embodiments of this disclosure, users can achieve secure backup and migration of chat history without sacrificing efficiency, improving user satisfaction and application usability.

[0129] Figure 12 Another schematic diagram of a data migration method 1000 according to an embodiment of the present disclosure is shown.

[0130] Optionally, combined Figure 2 It can be doneFigure 2 The chat history migration process is initiated through trigger actions on the primary and secondary pages of the app. Users can initiate the entire chat history migration task by selecting and confirming the migration operation on the primary and / or secondary pages of the app being migrated from.

[0131] After successfully initiating the migration process, the sending device immediately enters the network configuration phase. At this point, the sending device automatically retrieves its local IP address and port number for establishing subsequent network connections. Once these network parameters are obtained, the sending device starts a server instance and enters a listening state, awaiting communication connection messages from the receiving device. This listening mechanism ensures that once the receiving device sends a connection request, the sending device can immediately respond and establish a stable data transmission channel to facilitate the subsequent migration of chat log data.

[0132] After the migrated device successfully starts listening on the server, the next step is to generate and send a control message for detecting its own network environment. This control message can be received by the migrated device itself, thus forming a closed-loop communication process. The control message contains key network parameters such as the local machine's IP address and port number to establish a data transmission channel.

[0133] Optionally, the control message is designed to follow a specific protocol format, typically consisting of a message header and a message body. The message header may contain information such as message type and version number, while the message body contains the actual control commands and network parameters. Sending the control message is not only for initializing data transmission but also for checking the network environment, ensuring that the migrated device can receive messages from itself, thereby verifying the correctness of the network configuration and the validity of the server's listening status.

[0134] Next, the migration device initiates a data extraction thread to initialize the underlying database (DB). The data extraction thread first attempts to access the data source storing the chat logs, then allocates necessary resources for data reading and serialization, including memory allocation and connection pool configuration. Furthermore, the data extraction thread sets up error handling and exception handling mechanisms to address potential database access problems, thereby ensuring the stability and efficiency of the data migration.

[0135] The data extraction thread can retrieve chat log data from the database. This data is typically organized by session, and the outgoing device will read the chat logs from each session one by one in a specific order (such as time order or session ID order). Next, the portion of the chat logs read by the data extraction thread will be processed by the serialization thread, as previously mentioned... Figure 10 The process has been described in detail, and will not be repeated here.

[0136] Subsequently, the data sending thread sends the serialized chat log data to the receiving device in batches. To improve transmission efficiency, the data sending thread adopts a batch sending strategy, organizing multiple messages into batches and pre-determining the storage path of each message attachment through a parallel computing mechanism. This parallel processing method significantly reduces waiting time and optimizes resource utilization. After a batch of text messages is successfully sent, the data sending thread immediately sends the attachment files for that batch, ensuring the integrity and consistency of the messages and their attachments.

[0137] After each batch of messages and attachments is sent, the data sending thread enters the next loop to continue processing subsequent batches of data. This cyclical sending mechanism ensures continuous data transmission until all chat log data has been sent. Throughout the process, the data sending thread continuously monitors network status and transmission quality, dynamically adjusting sending strategies to adapt to different network environments, ensuring the stability and efficiency of data transmission.

[0138] In addition to chat log data, the data sending thread also processes other file types, such as Full-Text Search Index (FTS), Key-Value Store (KV), and application settings. These files contain metadata, configuration information, and accessibility data for the chat logs, essential for maintaining search capabilities, personalization settings, and application status. Although some file types, such as FTS, may only exist in mobile applications, the data sending thread will intelligently select and send the appropriate files based on device type and application requirements. This processing strategy ensures that devices after chat log migration can fully restore the user's usage environment and habitual settings.

[0139] Through the data sending thread, chat history migration not only ensures data integrity and consistency, but also provides users with a seamless experience, enabling efficient and reliable chat history migration on both mobile and desktop devices.

[0140] Figure 13 A flowchart illustrating a data migration method 1300 according to an embodiment of the present disclosure is shown.

[0141] Among them, the data migration method 1300 can be performed by the chat history migration device.

[0142] During the migration of chat logs, the operations on the receiving device and the exporting device are mirror images of each other. Of course, this disclosure is not limited to this.

[0143] like Figure 13 As shown, in step S1310, a control message is received, which indicates device discovery information related to the data migration object.

[0144] For example, the receiving device can receive control messages from the sending device of the chat history, the control messages indicating device discovery information related to the chat history migration object.

[0145] Optionally, after the receiving device receives the control message, the receiving device displays a migration page, which includes a migration confirmation button; in response to the migration confirmation button being triggered, a first communication connection message indicating agreement to migrate the chat history is sent; in response to the migration confirmation button not being triggered, a second communication connection message indicating disagreement to migrate the chat history is sent.

[0146] Optionally, after the receiving device receives a control message, in response to receiving a control message from the sending device, it compares its own free storage space with the storage space for storing the chat records to be migrated; in response to the fact that its own free storage space is insufficient to store the chat records to be migrated, it sends a second communication request message indicating disagreement with the migration of the chat records. If the receiving device's free storage space is insufficient to store the chat records to be migrated, it may display the following message: Figure 9 The interface shown. It is worth noting that... Figure 9 The interface shown can be displayed on both the receiving and sending devices, but this disclosure is not limited thereto.

[0147] In step S1320, a communication request message is received, which indicates information about the communication interface of the data transfer device, and the communication interface is used to transmit data.

[0148] Optionally, the receiving device can receive a communication request message from the sending device of the chat history, the communication request message indicating information about the communication interface of the receiving device of the chat history, the communication interface being used to transmit the chat history.

[0149] In step S1330, in response to the data migration object in the control message matching the current device, a communication connection message is sent, indicating that the current device can receive data from the data migration device.

[0150] For example, the receiving device may send a communication connection message in response to a data migration object matching the current device in the control message, the communication connection message indicating that the current device can receive data from the data migration-out device.

[0151] Optionally, the sending of the communication connection message further includes: displaying a migration page in response to receiving a control message from the data migration device; and sending a first communication connection message indicating agreement to migrate the data in response to a migration confirmation operation. Additionally, optionally, a second communication connection message indicating disagreement to migrate the data is sent in response to a migration denial operation.

[0152] For example, the migration page may include a migration confirmation button. When the migration confirmation button is triggered, the receiving device can send a first communication connection message to the sending device indicating agreement to migrate the chat history; when the migration confirmation button is not triggered, the receiving device can send a second communication connection message to the sending device indicating disagreement to migrate the chat history.

[0153] For example, in response to the chat history migration object in the control message matching the local machine, a communication connection message is sent to the chat history migration-out device, the communication connection message indicating that the chat history migration-in device can receive chat history from the chat history migration-out device.

[0154] Optionally, sending a communication connection message to the device from which the chat history is being migrated includes: determining subnet information matching the communication interface of the device from which the chat history is being migrated based on the information of the communication interface of the device from which the chat history is being migrated; determining communication interface information for receiving the chat history on the local machine based on the subnet information matching the communication interface of the device from which the chat history is being migrated; and generating and sending the communication connection message on the local machine based on the communication interface information for receiving the chat history.

[0155] In step S1340, after establishing a communication connection with the data transfer-out device, data is received. Optionally, after receiving the data, a confirmation interface for importing the data can be displayed. After the user confirms the import operation, the current device's database can be updated based on the received data, and a chat session page can be displayed based on the updated local database.

[0156] For example, after establishing a communication connection with the device that sent the chat records, the receiving device receives the chat records. Optionally, method 1300 further includes: in response to completing the reception of the chat records, displaying a confirmation interface for importing chat records, the confirmation interface including an import confirmation button; in response to the import confirmation button being triggered, updating the local database based on the received chat records; and displaying a chat session page based on the updated local database.

[0157] Furthermore, updating the current device's database based on the received data also includes: addressing the address used to store the chat session in the current device's database based on the chat session identifier in the received data; and updating the current device's database based on the differences between the chat session information stored in the current device's database and the chat session in the received data.

[0158] For example, the migrating device can parse received data packets and extract a unique identifier for each chat session. It then uses these identifiers to search the current device's database to determine the specific address used to store these chat sessions. Next, the migrating device compares the chat session information already stored in the current device's database with the newly received data to identify new messages, deleted messages, edited messages, and changes to metadata (such as timestamps, sending status, etc.). The migrating device can use the timestamp of each chat record in the chat session as one of the reference information for merging chat records to determine the differences between the received data and the chat session data stored in the current device's database. Based on the results of the difference analysis, the migrating device can then update the current device's database. For new messages, the migrating device will insert them in the appropriate position to maintain the chronological order of the sessions; for deleted or edited messages, the migrating device will update or mark these messages accordingly. Furthermore, the migrating device needs to handle potential conflicts, such as different edits to the same message on different devices. For example, the message might be referenced on one device, while it might be deleted on another. In this situation, the incoming device may directly delete the message based on the conflict resolution mechanism, or retain multiple versions for the user to choose from.

[0159] Figure 14 Another schematic diagram of a data migration method 1300 according to an embodiment of the present disclosure is shown.

[0160] like Figure 14As shown, after receiving a control message indicating device discovery information related to the chat history migration target, the receiving device parses the control information. If the information of the receiving device indicated in the control message matches the local device, a migration page can be displayed. The migration page allows the user to visually monitor and operate the chat history migration process on the receiving device. Optionally, the migration page includes a migration confirmation button. If the user triggers the migration confirmation button, it indicates that the user agrees to migrate the chat history stored in the sending device to the receiving device. At this time, the background of the receiving device will send a first communication connection message indicating agreement to migrate the chat history. If the user does not click the migration confirmation button, the background of the receiving device can send a second communication connection message indicating disagreement to migrate the chat history. It is worth noting that both the first and second communication connection messages can be references. Figures 10 to 12 The communication connection message described.

[0161] Next, if the user triggers the migration confirmation button, the communication connection establishment phase begins. After the receiving device resolves the IP address of the sending device obtained from the control information, the sending device will perform a subnet matching check to determine the optimal connection path. Subnet matching involves selecting an IP address that matches the current device's subnet for connection, thereby improving data transmission efficiency and stability. After determining the connection target, the system will use the corresponding port information to initialize the TCP connection, preparing to receive chat logs.

[0162] After the TCP connection is established, the receiving device sends a "TCP ready" signal to indicate that it is ready to receive chat logs. The "TCP ready" signal carries necessary connection information and status indicators to ensure that the receiving device can recognize and confirm the connection establishment. Afterward, the receiving device begins receiving chat logs. The receiving device will receive messages sequentially, including text messages and attachments, processing and storing each batch of data received.

[0163] Finally, after receiving all data, the receiving device triggers the chat history import process. This process requires the user to click the import confirmation button on the chat history confirmation screen. The chat history import process involves integrating the received data into a local database or file system, ensuring the integrity and availability of the chat history. After the chat history migration process is successfully completed, the user can continue any chat session on the new device, seamlessly continuing previous conversations.

[0164] It is worth noting that both Method 1000 and Method 1300 can be implemented in C++ to enhance the adaptability and flexibility of the chat history migration solution. C++'s near-hardware nature allows for broad support across different operating systems and hardware platforms. By deeply controlling memory and handling hardware interactions through C++, every detail of the chat history migration process can be optimized, achieving high performance and stability on various devices. Furthermore, C++ programs, due to their lightweight and efficient execution, can run with a smaller size and lower resource consumption, enabling resource optimization on performance-constrained devices. In Methods 1000 and 1300, data structures are optimized, network protocol stacks are adjusted, and the serialization and deserialization processes are directly controlled using C++ to adapt to specific chat history migration requirements. In addition, C++'s concise syntax and fast execution speed contribute to improved data transmission efficiency and stability.

[0165] Figure 15 A structural block diagram of an apparatus 1500 according to an embodiment of the present disclosure is shown. The apparatus 1500 can serve as a chat log transfer device.

[0166] like Figure 15 As shown, the device 1500 includes a first module 1510, a second module 1520, a third module 1530, a fourth module 1540, and a fifth module 1550.

[0167] Specifically, the first module 1510 can be configured to: display candidate devices for migratable data, and in response to an operation of selecting a target device for the data to be migrated, determine the target device from the candidate devices. The second module 1520 can be configured to: send a control message to each device corresponding to the account to which the data belongs, the control message indicating device discovery information related to the data migration object. The third module 1530 can be configured to: the communication request message indicating information about the communication interface of the data's originating device, the communication interface being used for data transmission. The fourth module 1540 can be configured to: receive a communication connection message from the target device, the communication connection message indicating that the target device is capable of receiving data. The fifth module 1550 can be configured to: migrate the data to the target device after establishing a communication connection with the data's target device. The data extraction thread is used to extract a portion of the chat records from the database of the originating device, the serialization thread is used to serialize the portion of the chat records, and the data sending thread is used to send the serialized portion of the chat records to the device to which the chat records are migrated.

[0168] Figure 16 A structural block diagram of an apparatus 1600 according to an embodiment of the present disclosure is shown. The apparatus 1600 can be used as a chat history import device.

[0169] like Figure 16 As shown, the device 1600 includes a first module 1610, a second module 1620, a third module 1630, and a fourth module 1640.

[0170] Specifically, the first module 1610 can be configured to: receive a control message indicating device discovery information related to a data migration object. The second module 1620 can be configured to: receive a communication request message indicating information about the communication interface of the data migration-out device, the communication interface being used for data transmission. The third module 1630 can be configured to: in response to a data migration object matching the current device in the control message, send a communication connection message indicating that the current device can receive data from the data migration-out device. The fourth module 1640 can be configured to: receive data after establishing a communication connection with the data migration-out device.

[0171] In addition, although Figures 15 to 16 The modules and sub-modules described above are illustrated by way of example. However, it should be understood that device 1500 or device 1600 may be divided in different ways depending on different functions, or may be divided into more or fewer modules, or each module may be divided into further more or fewer sub-modules. In some example embodiments, a module or its sub-module may be implemented using electronic hardware (e.g., a general-purpose processor, DSP, ASIC, FPGA or other programmable logic device, discrete gate or transistor logic, discrete hardware components, etc.), computer software (e.g., which may be stored in random access memory (RAM), flash memory, read-only memory (ROM), erasable programmable ROM (EPROM), etc.), or a combination of both.

[0172] According to another aspect of this disclosure, an electronic device is also provided for implementing the method according to embodiments of this disclosure. Figure 17 A schematic diagram of an electronic device 2000 according to an embodiment of the present disclosure is shown.

[0173] like Figure 17 As shown, the electronic device 2000 may include one or more processors 2010 and one or more memories 2020. The memories 2020 store computer-readable code that, when executed by the one or more processors 2010, can perform the methods described above.

[0174] The processor in this disclosure embodiment can be an integrated circuit chip with signal processing capabilities. The processor can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), an off-the-shelf programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, operations, and logic block diagrams disclosed in this disclosure embodiment. The general-purpose processor can be a microprocessor or any conventional processor, and can be based on an x86 architecture or an ARM architecture.

[0175] In general, the various exemplary embodiments of this disclosure can be implemented in hardware or dedicated circuitry, software, firmware, logic, or any combination thereof. Some aspects can be implemented in hardware, while others can be implemented in firmware or software that can be executed by a controller, microprocessor, or other computing device. When aspects of embodiments of this disclosure are illustrated or described as block diagrams, flowcharts, or using some other graphical representation, it will be understood that the blocks, apparatuses, systems, techniques, or methods described herein can be implemented as non-limiting examples in hardware, software, firmware, dedicated circuitry or logic, general-purpose hardware or controllers or other computing devices, or some combination thereof.

[0176] For example, the method or apparatus according to embodiments of this disclosure can also be used by means of Figure 18 The architecture of the computing device 3000 shown is used for implementation. For example... Figure 18 As shown, the computing device 3000 may include a bus 3010, one or more CPUs 3020, a read-only memory (ROM) 3030, a random access memory (RAM) 3040, a communication port 3050 connected to a network, an input / output component 3060, a hard disk 3070, etc. The storage devices in the computing device 3000, such as the ROM 3030 or the hard disk 3070, may store various data or files used for processing and / or communication of the methods provided in this disclosure, as well as program instructions executed by the CPU. The computing device 3000 may also include a user interface 3080. Of course, Figure 18 The architecture shown is merely exemplary and can be omitted as needed when implementing different devices. Figure 18 One or more components in the computing device shown.

[0177] According to another aspect of this disclosure, a computer-readable storage medium is also provided. Figure 19 A schematic diagram of a storage medium 4000 according to the present disclosure is shown.

[0178] like Figure 19As shown, the computer storage medium 4020 stores computer-readable instructions 4010. When the computer-readable instructions 4010 are executed by a processor, the method described with reference to the above figures according to embodiments of the present disclosure can be performed. The computer-readable storage medium in the embodiments of the present disclosure may be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. Non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory may be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous linked dynamic random access memory (SLDRAM), and direct memory bus random access memory (DR RAM). It should be noted that the memory used in the methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.

[0179] This disclosure also provides a computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform a method according to an embodiment of this disclosure.

[0180] It should be noted that the flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0181] In general, the various exemplary embodiments of this disclosure can be implemented in hardware or dedicated circuitry, software, firmware, logic, or any combination thereof. Some aspects can be implemented in hardware, while others can be implemented in firmware or software that can be executed by a controller, microprocessor, or other computing device. When aspects of embodiments of this disclosure are illustrated or described as block diagrams, flowcharts, or using some other graphical representation, it will be understood that the blocks, apparatuses, systems, techniques, or methods described herein can be implemented as non-limiting examples in hardware, software, firmware, dedicated circuitry or logic, general-purpose hardware or controllers or other computing devices, or some combination thereof.

[0182] The exemplary embodiments of this disclosure described in detail above are merely illustrative and not restrictive. Those skilled in the art will understand that various modifications and combinations of these embodiments or their features can be made without departing from the principles and spirit of this disclosure, and such modifications should fall within the scope of this disclosure.

Claims

1. A method for data migration, comprising: displaying candidate devices of migratable data, and determining a target device of the data from the candidate devices in response to an operation of selecting the target device; sending a control message to each device corresponding to an account to which the data belongs, the control message indicating device discovery information related to a data migration object; broadcasting a communication request message, the communication request message indicating information of a communication interface of a migration-out device of the data, the communication interface being used for transmitting data; receiving a communication connection message of the target device, the communication connection message indicating that the target device is capable of receiving data; after establishing a communication connection with the target device of the data, migrating the data to the target device. The migrating the data to the target device comprises:

2. The method of claim 1, wherein, parallelly executing a data extraction thread, a serialization thread and a data sending thread, wherein the data extraction thread is used for extracting partial data from a database of the migration-out device, the serialization thread is used for serializing the partial data, and the data sending thread is used for sending the serialized partial data to the target device. The method is executed by a migration-out device of the data, and the migration-out device sends the control message via a wide area network, broadcasts the communication request message via a local area network, and receives the communication connection message via the local area network.

3. The method of claim 1, wherein, The determining the target device from the candidate devices comprises:

4. The method of claim 1, wherein, based on an operation of triggering a data migration function, sending a search request with a filtering parameter to a background server, so that the background server searches device information that meets the filtering parameter and logs in using an account to which the data belongs; receiving a search result from the background server, and displaying the device information that meets the filtering parameter based on the search result; and receiving information for selecting and confirming the target device of the data. The data is chat records, and the data extraction thread extracts text messages of a predetermined number of chat sessions in the chat records from a database first, and then extracts attachment messages in the chat sessions from the database.

5. The method of claim 1, wherein, The communication request message comprises a header field and a data field, and the data field comprises a device type, a device identifier, an IP address and a port number corresponding to the migration-out device.

6. The method of claim 1, wherein, The data sending thread encapsulates the serialized partial chat data into a data packet, and the data packet comprises a message type field, a message length field and a message content field.

7. The method of claim 1, wherein, 8.A method for migrating data, comprising: receiving a control message, the control message indicating device discovery information related to a data migration object; receiving a communication request message, the communication request message indicating information of a communication interface of a migration-out device of the data, the communication interface being used for transmitting data; in response to the data migration object in the control message matching a current device, sending a communication connection message, the communication connection message indicating that the current device is capable of receiving data from the migration-out device of the data; after establishing a communication connection with the migration-out device of the data, receiving data. 9.The method of claim 8, wherein the sending the communication connection message further comprises: ​ ​ in response to receiving the control message from the data migration-out device, display a migration page; in response to a migration confirmation operation, send a first communication connection message indicating agreement to migrate the data.

10. The method of claim 8, wherein, The method further includes: in response to receiving the control message, comparing free storage space of the current device with storage space storing data to be migrated; in response to the free storage space of the current device being insufficient to store the data to be migrated, sending a second communication request message indicating disagreement to migrate the data.

11. The method of claim 8, wherein, The sending of the communication connection message includes: determining subnet information matching the communication interface of the migration-out device based on information of the communication interface of the data migration-out device; determining communication interface information of the current device for receiving the data based on the subnet information matching the communication interface of the migration-out device; and generating and sending the communication connection message based on the communication interface information of the current device for receiving the data.

12. The method of claim 8, further comprising: in response to completing the reception of the data, displaying a confirmation interface for importing the data; in response to a confirmation operation, updating a database of the current device based on the received data; based on the updated local database, displaying a chat session page.

13. The method of claim 12, wherein, The data is a chat record, and the updating of the database of the current device based on the received data further includes: addressing an address for storing the chat session in the database of the current device based on an identification of the chat session in the received data; and updating the database of the current device based on differences between information of the chat session stored in the database of the current device and the chat session in the received data.

14. An apparatus for migrating data, the apparatus comprising: a first module configured to display candidate devices of migratable data, and determine a target device of migrating-in data from the candidate devices in response to an operation of selecting the target device; a second module configured to send a control message to each device corresponding to an account to which the data belongs, the control message indicating device discovery information related to data migration objects; a third module configured to broadcast a communication request message, the communication request message indicating information of a communication interface of a migration-out device of the data, the communication interface being used for transmitting data; a fourth module configured to receive a communication connection message of the target device, the communication connection message indicating that the target device is capable of receiving data; and a fifth module configured to migrate the data to the target device after establishing a communication connection with the target device of the data.

15. An apparatus for migrating data, the apparatus comprising: a first module configured to receive a control message, the control message indicating device discovery information related to data migration objects; a second module configured to receive a communication request message, the communication request message indicating information of a communication interface of a migration-out device of the data, the communication interface being used for transmitting data; a third module configured to, in response to the data migration object in the control message matching the current device, send a communication connection message indicating that the current device is able to receive data from the data migration-out device; and a fourth module configured to, after establishing a communication connection with the data migration-out device, receive data.

16. An electronic device comprising: a processor; and a memory having stored thereon a computer program which, when executed by the processor, causes the processor to implement the steps of the method of migrating data according to any one of claims 1-13.

17. A computer readable storage medium having stored thereon a computer program which, when executed by a processor, causes the processor to implement the steps of the method of migrating data according to any one of claims 1-13.