CN112737928B - Instant communication message sending method and device - Google Patents

Instant communication message sending method and device Download PDF

Info

Publication number
CN112737928B
CN112737928B CN202110021532.3A CN202110021532A CN112737928B CN 112737928 B CN112737928 B CN 112737928B CN 202110021532 A CN202110021532 A CN 202110021532A CN 112737928 B CN112737928 B CN 112737928B
Authority
CN
China
Prior art keywords
data
message
receiving end
offline
time
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110021532.3A
Other languages
Chinese (zh)
Other versions
CN112737928A (en
Inventor
周建朋
刘林
谢玉鑫
胡杨
杜伟
胡翠梅
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Jinxiandai Information Industry Co ltd
Original Assignee
Jinxiandai Information Industry Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Jinxiandai Information Industry Co ltd filed Critical Jinxiandai Information Industry Co ltd
Priority to CN202110021532.3A priority Critical patent/CN112737928B/en
Publication of CN112737928A publication Critical patent/CN112737928A/en
Application granted granted Critical
Publication of CN112737928B publication Critical patent/CN112737928B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L51/00User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
    • H04L51/04Real-time or near real-time messaging, e.g. instant messaging [IM]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L51/00User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
    • H04L51/21Monitoring or handling of messages
    • H04L51/214Monitoring or handling of messages using selective forwarding
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1095Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention discloses an instant communication message sending method and device, wherein messages which are not successfully pushed by a server are stored in a message synchronization database, after a receiving end is on line, the receiving end caches corresponding messages in the message synchronization database to the local, and the receiving end compares the pushing time with the storage time of the latest data recorded by a receiving end local data table, so that the data which are not received by the receiving end are screened out, and the data are inserted into the receiving end local data table and displayed. Because the server stores the offline data, and the repeated data sent by the server cannot be generated after the offline data request is re-online at the offline receiving end every time, the problem of repeated receiving of the data received by the receiving end does not exist.

Description

Instant messaging message sending method and device
Technical Field
The invention relates to an instant messaging message sending method and an instant messaging message sending device.
Background
With the advent of the network era, the traditional communication mode has also changed, and more instant communication tools appear in the public sight, providing various convenience for the working and living of people. The instant messaging tool is an indispensable part of modern public life, and has the remarkable characteristics of real-time communication, cross-platform performance, rich content, low cost, high efficiency and the like. When using these instant messaging tools, various situations may be encountered, for example, a network is unstable due to network fluctuation, especially, a wireless network with relatively poor communication quality stability may not maintain the connection between the client and the server well, and meanwhile, the situation that the client may be frequently off-line needs to be considered.
In some implementations, in order to ensure that the instant messaging information is accurately delivered and is prevented from being lost, a response mode is adopted, that is, the sending end sends a message to the receiving end, if the receiving end receives the message, a receipt is sent to the sending end to indicate that the message is received, and if the sending end does not receive the receipt within the preset time, the message is sent again. It should be noted that, under the same network environment, the message sent by the sending end may be lost, and accordingly, the receipt may also be lost, so that, based on the aforementioned answering method, the problem of retransmission of information may occur inevitably when the receipt cannot be accurately sent. Especially, if the receiving end is off-line, the receipt cannot be sent in time, and the sending end sends the receipt once at preset time intervals.
In such an implementation, a sending end divides information to be sent into a plurality of packets according to an agreed rule, each packet is given a special identification, a receiving end identifies whether all packets in the information are completely received or not according to the receiving integrity of the special identifications, if the receiving is incomplete, the receiving end feeds back a signal to the sending end, and after the sending end receives the signal, the sending end sends a copy of the information. It should be noted that the signal may also be lost, and if the transmitting end does not receive the signal, the information cannot be retransmitted.
Known instant messaging methods focus on the resolution of the message loss problem and ignore the resolution of the message retransmission problem. In order to further adapt to the condition of the receiving end in an off-line state, a copy is created at the server end by the message sent by the sending end, and the copy is deleted after the receiving end normally receives the corresponding message. Accordingly, the principle of confirming that the receiving end normally receives the corresponding message necessarily requires the interaction between the receiving end and the server end, which is the same as the first implementation.
Disclosure of Invention
The invention aims to provide an instant messaging message sending method for ensuring that information received by a receiving end is not repeated and lost.
In the embodiment of the invention, an instant messaging message sending method is provided, wherein a server pushes a message sent from a sending end to a receiving end to the receiving end, if the pushing is unsuccessful, the corresponding message is stored in a given message synchronous database, wherein the data which is not pushed successfully at least binds the pushing time;
after the receiving end is on line, sending a request for calling the offline data in the message synchronization database to the server; the server responds to the request, and calls corresponding offline data to return to the receiving end according to the storage time of the latest data received by the receiving end;
the receiving end caches the received offline data to the local and traverses the received offline data;
if the pushing time of the current offline data is later than the storage time of the latest received data of the locally stored message table and the sending end does not withdraw, inserting the data into the local data table of the receiving end and displaying the data; if so, the data is skipped.
Optionally, the request includes a time parameter recorded with the storage time;
and the server responds to the current request, inquires the offline data after the storage time recorded by the time parameter in the current request in the message synchronization database, and returns the offline data to the receiving end.
Optionally, before sending the offline data to the receiving end, the server encapsulates the offline data to be sent to form an encapsulation packet;
and the packaging packet is packaged with the number of the offline data, so that when the offline data are traversed, the number is reduced by one when one piece of data is compared until the remaining number is 0, and the traversal is finished.
Optionally, the encapsulation packet is encapsulated with an array corresponding to the offline data to record the operation and the operation time of the corresponding action.
Optionally, the operation comprises deleting and having read;
deleting an instruction for indicating that the sending end deletes the corresponding data;
read indicates that the receiving end has read the corresponding data.
Optionally, the array is synchronization information, and correspondingly, the operation time is a timestamp of the operation, and is used to match the storage time of corresponding data in the data table corresponding to the operation.
Optionally, the offline data is stored in a dictionary preset in the encapsulation packet, a key of the dictionary is an ID of the receiving end, and a value is message pushing time, an operation type and an operator.
Optionally, the offline data table is used for storing offline data in a dictionary, and is bound to the corresponding key-value pair based on the ID and the message push time.
Optionally, the step of requesting the server for offline data is encapsulated as an offline message synchronization interface module;
and after the client is on-line again from the off-line state, triggering the off-line message synchronous interface module.
In an embodiment of the present invention, there is also provided an instant messaging message sending apparatus, including:
the off-line message storage unit is used for pushing the message sent from the sending end to the receiving end by the server, if the pushing is unsuccessful, the corresponding message is stored in a given message synchronous database, wherein the data which is not pushed successfully at least binds the pushing time;
the request unit sends a request for calling offline data in the message synchronization database to the server after the receiving end is online; the server responds to the request, and calls corresponding offline data to return to the receiving end according to the storage time of the latest data received by the receiving end;
the traversing unit caches the received offline data to the local by the receiving end and traverses the received offline data;
the screening unit is used for inserting the data into a local data table of a receiving end and displaying the data if the pushing time of the current offline data is later than the storage time of the latest received data of a locally stored message table and the sending end does not withdraw; if so, the data is skipped.
In the embodiment of the invention, the message which is not successfully pushed by the server is stored in the message synchronization database, after the receiving end is on line, the receiving end caches the corresponding message in the message synchronization database to the local, and compares the pushing time with the storage time of the latest data recorded by the local data table of the receiving end, so as to screen out the data which is not received by the receiving end, and further inserts the data into the local data table of the receiving end for display. If the sending end withdraws the relevant data before the receiving end is on line, the sending end skips the data and does not display the data on the receiving end any more. In this process, the reception of the file has a temporally defined sequential relationship based on which missing data is not easily generated. Meanwhile, due to the fact that the offline data are stored in the server, and after the offline data request is on-line again at the offline receiving end every time, data sent out repeatedly cannot be generated, and therefore the problem of repeated receiving of the data received by the receiving end does not exist.
Drawings
Fig. 1 is a data structure of an offline data package syncessagedatabean in an embodiment.
Fig. 2 is a diagram illustrating an embodiment of instant messaging method data flow transition.
Detailed Description
An instant messaging terminal is called a client, and information has a determined sending end and a receiving end based on the relation between an information source and an information sink, wherein the client for sending the information is the information source and is marked as the sending end, and the destination for sending is the receiving end. Hereinafter, the a client indicates a transmitting end, and the B client indicates a receiving end.
It should be noted that instant messaging is communication between two interactive parties, and two clients are a sending end and a receiving end.
When the client performs instant messaging chat and the client a sends a message to the client B, the message sent by the client a is first sent to an openfire server (instant messaging server) after being encapsulated according to a predetermined format, and it can be understood that the client a stores the sent message in a local data table.
Correspondingly, the server will store the message received from the client a in the server database, the precondition is that the client a is currently online, if the client a is not currently online, the data table of the client a will still store the message intended to be sent, but will prompt the failure of sending, and at this time, the server will not store the relevant message because it has not received the relevant message. In the following, the condition that the sending end is currently in the online state is taken as a condition, and the condition that the sending end is in the offline state is not within the consideration range of the present invention, and is not described herein again.
It should be noted that, the server may store all data sent by the terminal, and in the embodiment of the present invention, the database used for storing, for example, all messages exchanged between the client a and the client B is a message archive database. In embodiments of the invention, however, a message synchronization database is invoked that only holds messages for a fixed number of days, for example, for seven days. One of the characteristics of instant messaging is the temporality, and the temporality of link establishment, and the interaction is often completed in a relatively short time, and the message synchronization database only stores data for a fixed number of days, which helps to reduce the burden of the system.
Generally speaking, when a server pushes a message to a receiving end, it is not detected whether the receiving end is online, but in some implementations, the server needs to first determine whether to establish a connection with the receiving end, but this implementation manner needs to continuously determine whether the receiving end is online, and occupies more system resources.
After receiving the message, the server pushes the received message to the client B based on the connection between the client A and the client B, and if the client B is online, the server receives the message normally, stores the message into a chat log table of a local database of the client B, and displays the message on an interface.
However, when the B client is offline, because the instant messaging message is sent in real time, the B client cannot store the currently received message in the local database table in real time in an unopened state, which may cause the loss of the message.
Further, if the user opens the B client (here, the client is an offline client, and at this time, the problem that the client sends a message to another client is not considered at first, and only the problem that the message is lost due to the fact that messages sent to the client by other clients are considered when the client is in an offline state is considered), it is monitored that the B client program enters a foreground active state, the user login state of the current B client is judged, and if the client is in the logged-in state, the B client calls an offline message synchronization interface.
The off-line message synchronization interface may be a subprocess, or a control word, or a character string containing a plurality of instructions and configuration thereof, and is called by the B client after re-online, or called by the receiving end after re-online. The situation is suitable for the active offline of the client side B and the situation that information generated due to poor network communication quality cannot be received correctly.
In the preferred embodiment, the offline message synchronization interface has 4 parameters, which are transmitted by the B client to the server: and inquiring a database table CHATLOGS of the current B client side, finding out the stored time messageTime of the latest received message, the time syncTime of the last calling of the offline message synchronization interface (the stored time messageTime and the offline data are returned together after the offline synchronization interface is called each time, and the stored time syncTime and the offline data are cached in a local sandbox after the offline synchronization is finished), the number of the returned offline messages per page pageSize and the current requested page number pageNum.
After the offline message synchronization interface is successfully called, the server returns SyncMessageDataBean to the client B. The SyncMessageDataBean has a data structure shown in fig. 1, which is composed of a log message model (dictionary), stamp message processing time (array), and synchronization time (string).
After the client side acquires the syncessagedatabean, the client side firstly traverses the syncessagedatabean. Stamp each tuple element contains bid-message identification, time-operation time, Type-operation state, wherein the operation state mainly contains deletion and read. For example, the a client sends a message "test" to the B client (both online), then the user operates to withdraw this message "test" at the a client, this operation will store the currently withdrawn time in syncessagedatabeam.stamp (the storage type is delete, the time is the current operation time, bid is the message identifier of "test"), and according to the deletion time in the syncessagedatabeam.stamp list, the message in the B client CHATLOGS table (for distinction, hereinafter referred to as "EIM _ CHATLOGS table") will be compared with the message in the B client CHATLOGS table to delete the stored "test" message. If the message is not canceled by the a, the B client receives and checks the message sent by the a, the read time is also stored in syncmessagedatabeam.
After traversing syncmessagedatabean. Log is a dictionary, which is composed of pageCount offline message total number, pageSize data amount per page, pageNum current page number, list of list current page number offline message data. Comparing log.pagenum log.pagesize with log.pagecount to judge whether the synchronization is finished, if so, caching SyncMessageDataBean.SyncTime locally, and recording the synchronization time. And traversing log.list to obtain each piece of offline message data. And taking out the time of deletion according to the processing of SyncMessageDataBean. For other messages which have no read or delete marks, the EIM _ CHATLOGS table is inserted one by one according to the time sequence and is presented in the interface of the B client.
Regarding the server-side message service, the following is summarized:
1. after receiving the message, the server side message service judges whether the message receiving end is on-line, if so, the server side message service directly forwards the message to the receiving end, and if not, the server side message service directly stores the message into a message synchronization database.
2. Off-line message synchronization interface: and according to the parameters transmitted by the receiving end, inquiring the offline message from the message synchronization database and returning the offline message to the client. Each time the synchronization is only for synchronizing the messages which the client does not have, the existing messages can not be synchronized repeatedly.

Claims (10)

1. A method for sending instant communication message is characterized in that a server pushes a message sent from a sending end to a receiving end to the receiving end, if the pushing is unsuccessful, the corresponding message is stored in a given message synchronous database, wherein the data which is not pushed successfully at least binds the pushing time;
after the receiving end is on line, sending a request for calling offline data in the message synchronization database to the server; the server responds to the request, and calls corresponding offline data to return to the receiving end according to the storage time of the latest data received by the receiving end;
the receiving end caches the received offline data to the local and traverses the received offline data;
if the push time of the current offline data is later than the storage time of the latest received data of the locally stored message table and the sending end does not withdraw, inserting the data into the local data table of the receiving end and displaying the data; if so, the data is skipped.
2. The method according to claim 1, wherein the request includes a time parameter recorded with the storage time;
and the server responds to the current request, inquires the offline data after the storage time recorded by the time parameter in the current request in the message synchronization database, and returns the offline data to the receiving end.
3. The method according to claim 2, wherein the server encapsulates the pre-sent offline data to form an encapsulation packet before sending the offline data to the receiving end;
and the packaging packet is packaged with the number of the offline data, so that when the offline data are traversed, the number is reduced by one when one piece of data is compared until the remaining number is 0, and the traversal is finished.
4. The method according to claim 3, wherein the encapsulation packet encapsulates an array corresponding to the offline data to record the operation and the operation time of the corresponding action.
5. The method of claim 4, wherein the operation comprises deleting and having read;
deleting an instruction for indicating that the sending end deletes the corresponding data;
read indicates that the receiving end has read the corresponding data.
6. The method according to claim 4, wherein the array is synchronization information, and the operation time is a timestamp of the operation, and is used to match a storage time of corresponding data in the data table corresponding to the operation.
7. The method as claimed in claim 4, wherein the offline data is stored in a dictionary preset in the encapsulation packet, a key of the dictionary is an ID of a receiving end, and a value is a message push time, an operation type and an operator.
8. The method of claim 7, wherein an offline data table is used for storing offline data in a dictionary, and is bound to a corresponding key-value pair based on the ID and the message push time.
9. The instant messaging message transmission method of claim 1, wherein the step of requesting the server for the offline data is encapsulated as an offline message synchronization interface module;
and after the client is on-line again from the off-line state, triggering the off-line message synchronous interface module.
10. An instant messaging message sending device, comprising:
the off-line message storage unit is used for pushing the message sent from the sending end to the receiving end by the server, if the pushing is unsuccessful, the corresponding message is stored in a given message synchronous database, wherein the data which is not pushed successfully at least binds the pushing time;
the request unit sends a request for calling the offline data in the message synchronization database to the server after the receiving end is online; the server responds to the request, and calls corresponding offline data to return to the receiving end according to the storage time of the latest data received by the receiving end;
the traversing unit is used for caching the received offline data to the local by the receiving end and traversing the received offline data;
the screening unit is used for inserting the data into a local data table of a receiving end and displaying the data if the pushing time of the current offline data is later than the storage time of the latest received data of a locally stored message table and the sending end does not withdraw; if so, the data is skipped.
CN202110021532.3A 2021-01-08 2021-01-08 Instant communication message sending method and device Active CN112737928B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110021532.3A CN112737928B (en) 2021-01-08 2021-01-08 Instant communication message sending method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110021532.3A CN112737928B (en) 2021-01-08 2021-01-08 Instant communication message sending method and device

Publications (2)

Publication Number Publication Date
CN112737928A CN112737928A (en) 2021-04-30
CN112737928B true CN112737928B (en) 2022-07-15

Family

ID=75589557

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110021532.3A Active CN112737928B (en) 2021-01-08 2021-01-08 Instant communication message sending method and device

Country Status (1)

Country Link
CN (1) CN112737928B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113472892A (en) * 2021-07-18 2021-10-01 广州智会云科技发展有限公司 Multi-terminal synchronization method and system for unread and read states of message
CN114422466B (en) * 2022-01-20 2024-06-07 深圳市元征科技股份有限公司 Offline message processing method and device, electronic equipment and storage medium
CN114760259B (en) * 2022-04-27 2024-01-16 深圳小湃科技有限公司 Offline message sending method and device, electronic equipment and readable storage medium

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109462545A (en) * 2018-12-26 2019-03-12 北京云中融信网络科技有限公司 Message delet method and device

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104518953B (en) * 2013-09-30 2019-12-24 腾讯科技(深圳)有限公司 Method for deleting message, instant communication terminal and system
GB201408408D0 (en) * 2014-05-12 2014-06-25 Tomlinson Martin Method and apparatus for time limited messages in packet communications
CN104144116B (en) * 2014-07-16 2016-04-27 腾讯科技(深圳)有限公司 Instant communication method and instant communicating system
CN104883292B (en) * 2015-04-16 2017-03-22 江苏中威科技软件系统有限公司 Method and system for realizing message roaming at different terminals
CN109067910A (en) * 2018-09-13 2018-12-21 乐蜜有限公司 A kind of method and device that message pulls
CN112965835A (en) * 2019-01-31 2021-06-15 福建天泉教育科技有限公司 Method and terminal for efficiently displaying offline message
CN111654428B (en) * 2020-06-05 2022-05-17 天津卓朗科技发展有限公司 Offline message processing method and device and server

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109462545A (en) * 2018-12-26 2019-03-12 北京云中融信网络科技有限公司 Message delet method and device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
自建IM服务器的猿学习App的设计与实现;梁振伟;《电脑知识与技术》;20201225;第16卷(第36期);全文 *

Also Published As

Publication number Publication date
CN112737928A (en) 2021-04-30

Similar Documents

Publication Publication Date Title
CN112737928B (en) Instant communication message sending method and device
WO2021121370A1 (en) Message loss detection method and apparatus for message queue
EP1940107A1 (en) A method for processing data synchronization and client terminal, server and data synchronization system thereof
JP4943512B2 (en) Notification message processing method and apparatus
EP1980954A1 (en) Method, device and system for synchronizing of data providing for the handling of an interrupted synchronization process
US20090030917A1 (en) Multimedia messaging service-based database synchronization
CN103440142A (en) GPRS (General Packet Radio Service)-based remote upgrade and dynamic loading method
KR100728076B1 (en) Method, device and system for synchronizing of data providing for the handling of an interrupted synchronization process
CN110430126A (en) Instant communication message processing method, device, system, equipment and storage medium
CN111147126B (en) Beidou satellite short message communication data unpacking transmission method
CN111726414A (en) Vehicle reported data processing method and vehicle data reporting system
CN112838910A (en) Data transmission method and device based on hybrid feedback
EP3038032A1 (en) Service message transmitting method and device
CN110545243A (en) ICN message forwarding method
CN113342764A (en) Data synchronization method and device among different cloud servers
CN109918210B (en) Method and terminal for displaying offline message
KR20030030892A (en) System for transmitting sequences of packets between a server and a mobile terminal
CN111026566A (en) Client service error scene three-dimensional monitoring method and device
CN113645008B (en) Message protocol timeout retransmission method and system based on linked list
CN115865886A (en) Cross-network data interaction method and device based on HTTP
CN111625427B (en) Real-time monitoring system and method for configuring connection health status of central client
CN114422425A (en) Multilink aggregated data transmission method, system, device and storage medium
CN113794622A (en) Message processing method and device, electronic equipment and storage medium
CN111064674B (en) Data transmission method, device and system
CN111400064A (en) Method for calling fixed value and recording file across safety zone

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant