CN110198351A - Storage method, device, server-side and the readable storage medium storing program for executing of offline message - Google Patents

Storage method, device, server-side and the readable storage medium storing program for executing of offline message Download PDF

Info

Publication number
CN110198351A
CN110198351A CN201910460917.2A CN201910460917A CN110198351A CN 110198351 A CN110198351 A CN 110198351A CN 201910460917 A CN201910460917 A CN 201910460917A CN 110198351 A CN110198351 A CN 110198351A
Authority
CN
China
Prior art keywords
message
offline
client
offline message
server
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.)
Pending
Application number
CN201910460917.2A
Other languages
Chinese (zh)
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.)
WeBank Co Ltd
Original Assignee
WeBank 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 WeBank Co Ltd filed Critical WeBank Co Ltd
Priority to CN201910460917.2A priority Critical patent/CN110198351A/en
Publication of CN110198351A publication Critical patent/CN110198351A/en
Pending legal-status Critical Current

Links

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]
    • H04L51/043Real-time or near real-time messaging, e.g. instant messaging [IM] using or handling presence information
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services

Abstract

The invention discloses a kind of storage method of offline message, device, server-side and readable storage medium storing program for executing, the method comprising the steps of: after server-side receives the message write request of the first client transmission, whether the second client that detection receives the corresponding message to be written of the message write request is in off-line state;If detecting, second client is in off-line state, and the message to be written is determined as offline message;The offline message is written into preset memory database and preset non-relational database, and the validity period of the offline message is set in the memory database.Present invention saves the memory spaces of server-side memory database, and improve the reading efficiency of offline message.

Description

Storage method, device, server-side and the readable storage medium storing program for executing of offline message
Technical field
The present invention relates to the technical field of data transmission of financial technology (Fintech) more particularly to a kind of offline messages Storage method, device, server-side and readable storage medium storing program for executing.
Background technique
With financial technology, the especially continuous development of internet techno-financial (Fintech), more and more technologies (such as distributed, block chain Blockchain, artificial intelligence) is applied in financial field, but financial circles also propose more technology High requirement, more and more financial institutions borrow instant communication software and interact with user.Passing through instant communication software During interacting, instant communication message be stored in server-side MySQL (Relational DBMS) or In the relevant databases such as oracle.Server-side builds live collaboration server using Open Fire, server-side by with client The various offline messages such as long connection push user, good friend, group-list and the public platform established between end are to client, client's termination By carrying out respective handling after offline message.It follows that offline message is stored in the relationship types number such as MySQL or oracle at present According in library, but due to offline message quick obtaining, offline message is stored in relationship type number for a long time by the i.e. characteristic of failure after acquisition According in library, will cause the waste of server-side memory space, and cause offline message reading efficiency low.
Summary of the invention
The main purpose of the present invention is to provide a kind of storage method of offline message, device, server-side and readable storages Medium, it is intended to solve it is existing offline message is stored in the relevant database of server-side, cause server-side memory space Waste, the low technical problem of offline message reading efficiency.
To achieve the above object, the present invention provides a kind of storage method of offline message, the storage side of the offline message Method comprising steps of
After server-side receives the message write request of the first client transmission, detection receives the message write request Whether the second client of corresponding message to be written is in off-line state;
If detecting, second client is in off-line state, and the message to be written is determined as offline message;
The offline message is written into preset memory database and preset non-relational database, and described The validity period of the offline message is set in memory database.
Preferably, if described detect that second client is in off-line state, the message to be written is determined After the step of for offline message, further includes:
Determine the type of message of the offline message;
It is described that the offline message is written to the step into preset memory database and preset non-relational database Suddenly include:
Offline message classification is written into preset memory database according to the type of message, and according to institute It states type of message offline message classification is written into preset non-relational database.
Preferably, it after the step of validity period that the offline message is set in the memory database, also wraps It includes:
After detecting that the second client successfully logs in, detect whether there is and second visitor in the memory database The corresponding offline message to be obtained in family end;
If there are the offline messages to be obtained in the memory database, it is determined that described in the memory database The message number and type of message of offline message to be obtained;
The type of message and the message number are sent to second client, for the second client root The offline message to be obtained is obtained in the server-side according to the type of message and the message number.
Preferably, described after detecting that the second client successfully logs in, detecting whether there is in the memory database After the step of offline message to be obtained corresponding with second client, further includes:
If there is no the offline message to be obtained in the memory database, detect in the non-relational database With the presence or absence of the offline message to be obtained;
If there are the offline messages to be obtained in the non-relational database, it is determined that the non-relational database In, the message number and type of message of the offline message to be obtained;
The type of message and the message number are sent to second client, for the second client root The offline message to be obtained is obtained in the server-side according to the type of message and the message number.
Preferably, the described the step of type of message and the message number are sent to second client it Afterwards, further includes:
After receiving the data pull request that second client is sent by hypertext transfer protocol HTTP, according to The data pull requests corresponding device identification and type of message by the corresponding offline message to be obtained of second client It is sent to second client.
Preferably, described that the offline message is written to preset memory database and preset non-relational database In, and after the step of validity period of the offline message is set in the memory database, further includes:
It detects second client and whether is pulled from the memory database within the validity period and described disappeared offline Breath;
If second client does not pull the offline message within the validity period from the memory database, Delete the offline message in the memory database.
Preferably, after the message write request that the transmission of the first client is received when server-side, described in detection reception The step of whether the second client of the corresponding message to be written of message write request is in off-line state include:
After server-side receives the message write request of the first client transmission, obtains and receive the message write request The status indicator of second client of corresponding message to be written, and detect whether the status indicator is to identify offline;
If detecting, the status indicator is offline mark, it is determined that second client is in off-line state.
In addition, to achieve the above object, the present invention also provides a kind of storage device of offline message, the offline message Storage device includes:
Detection module, after for receiving the message write request of the first client transmission when server-side, detection receives institute Whether the second client for stating the corresponding message to be written of message write request is in off-line state;
Determining module, if for detecting that second client is in off-line state, the message to be written is true It is set to offline message;
Writing module, for being written the offline message to preset memory database and preset non-relational data In library;
Setup module, for the validity period of the offline message to be arranged in the memory database.
In addition, to achieve the above object, the present invention also provides a kind of server-side, the server-side includes memory, processing Device and the storage program for being stored in the offline message that can be run on the memory and on the processor, the offline message Storage program the step of realizing the storage method of offline message as described above when being executed by the processor.
In addition, to achieve the above object, it is described computer-readable the present invention also provides a kind of computer readable storage medium It is stored with the storage program of offline message on storage medium, is realized such as when the storage program of the offline message is executed by processor The step of storage method of the upper offline message.
The present invention is detecting that reception disappears by receiving the message write request of the first client transmission in server-side When the second client that breath write request corresponds to message to be written is in off-line state, it is written into message and is determined as disappearing offline Breath, which is written into preset memory database and preset non-relational database, and in memory database It the validity period of middle setting offline message, avoids and stores offline message into the relevant database of server-side, utilize memory The high-performance literacy of database improves the reading efficiency of offline message, and offline message is arranged in memory database Validity period, and offline message is stored to non-relational database, it avoids that offline message being stored in server-side for a long time In deposit data library, on the basis of guaranteeing that user successfully can obtain offline message, depositing for server-side memory database is saved Space is stored up, and improves the reading efficiency of offline message.
Detailed description of the invention
Fig. 1 is the flow diagram of the storage method first embodiment of offline message of the present invention;
Fig. 2 is the flow diagram of the 5th embodiment of storage method of offline message of the present invention;
Fig. 3 is the functional schematic module map of the storage device preferred embodiment of offline message of the present invention;
Fig. 4 is the structural schematic diagram for the hardware running environment that the embodiment of the present invention is related to.
The embodiments will be further described with reference to the accompanying drawings for the realization, the function and the advantages of the object of the present invention.
Specific embodiment
It should be appreciated that the specific embodiments described herein are merely illustrative of the present invention, it is not intended to limit the present invention.
The present invention provides a kind of storage method of offline message, and referring to Fig.1, Fig. 1 is the storage side of offline message of the present invention The flow diagram of method first embodiment.
The embodiment of the invention provides the embodiments of the storage method of offline message, it should be noted that although in process Logical order is shown in figure, but in some cases, it can be to be different from shown or described by sequence execution herein Step.The storage method of offline message includes:
Step S10, after server-side receives the message write request of the first client transmission, detection receives the message Whether the second client of the corresponding message to be written of write request is in off-line state.
In embodiments of the present invention, the first client is message sending end, and the second client is message sink end, the first visitor Family end and the second client can be mobile phone, tablet computer, laptop, palm PC, personal digital assistant (Personal Digital Assistant, PDA) etc. the fixed terminals such as mobile terminals, and number TV, desktop computer.As the first visitor When family end will send messages to the second client, the first client and server-side establish long connection, and are sent by length connection Message write request is to server-side.Wherein, message write request is that the request into server-side is written in instant communication message, i.e., When communication information can be for wechat message, QQ message etc., it is to be understood that the first client be the end of transmission instant communication message End, the second client are to receive the terminal of instant communication message.Long connection, multiple numbers can be continuously transmitted in a connection by referring to According to packet, during connecting holding, if sent without data packet, both sides is needed to send out link detecting packet.
After server-side receives the message write request of the first client transmission, server-side detection receives message write-in and asks Ask whether the second client of corresponding message to be written is in off-line state.It should be noted that in message write request, Carry the instant communication message in server-side to be written, in the instant communication message, carry receive the instant messaging disappear The device identification for ceasing client, can determine the second client corresponding with the first client by the device identification.Specifically, if Standby mark can be to use the user name of the second client user and/or UUID (the Universally Unique of the second client Identifier, Universally Unique Identifier), the user name of the second client user can be infused in instant communication software for the user The account generated when volume, such as WeChat ID and QQ number.
It should be noted that in the present embodiment, server-side can be used Open Fire and build live collaboration server, Tigase or Ejabberd etc. can be used and build live collaboration server, with realize server-side using different communication protocol with The first client and the second client carry out message transmission.Open Fire be it is free, open source, based on can expand communication and Presentation protocol (XMPP (Extensible Messaging and Presence Protocol, expansible communication and expression association View)), using Java programming language develop live collaboration server.Tigase is a kind of NIO (New realized using Java Input/Output frame) is communicated.Ejabberd is the instant communication server based on Jabber/XMPP agreement.
Further, step S10 includes:
Step a obtains the reception message and writes after server-side receives the message write request of the first client transmission Enter the status indicator of the second client of the corresponding message to be written of request, and detects whether the status indicator is to identify offline.
Step b, if detecting, the status indicator is offline mark, it is determined that second client is in offline shape State.
Specifically, after server-side receives the message write request of the first client transmission, server-side, which obtains to receive, to disappear Breath write request correspond to message to be written the second client status indicator, and detection the second client status indicator whether To identify offline.Wherein, there are two states marks for the second client, and one is offline marks, and one is online marks, offline Mark and the specific manifestation form identified online are arranged according to specific needs, such as can set " 00 " for offline mark, Line mark is set as " 11 ", or sets " 0FF " for offline mark, sets " FF " etc. for online mark.
If server-side detects that the status indicator of the second client is offline mark, server-side is determined at the second client In off-line state;If server-side detects that the status indicator of the second client is online mark, server-side determines the second client End is online.It should be noted that the user when the second client logs in the corresponding Instant Messenger of message write request When believing software, its status indicator in server-side can be revised as identifying online by the second client from offline mark;When second When the user of client exits the message write request corresponding instant communication software, the second client can be by it in server-side Status indicator be revised as identifying offline from online mark.
Step S20, if detecting, second client is in off-line state, by the message to be written be determined as from Line message.
When server-side detects that the second client is in off-line state, server-side by the message write request it is corresponding to Write-in message is determined as offline message, i.e., is determined as disappearing offline by the corresponding instant communication message to be written of the message write request Breath.
The offline message is written into preset memory database and preset non-relational database step S30, And the validity period of the offline message is set in the memory database.
Offline message is written into preset memory database and preset non-relational database server-side, will be from Line message store into memory database and non-relational database in, and in memory database be arranged offline message it is effective Phase.In the present embodiment, offline message is stored into memory database and non-relational number using Key-Value data structure According in library.Specifically, the name of Key is distinguished by fields such as user name, UUID and chat scenarios.Chat scenario include but It is not limited to single chat scene, group chat scene and public platform chat scenario, the corresponding scene identity of different chat scenarios is different , such as in the present embodiment, message can be set to the scene identity of single chat scene, set group chat scene for Notify Scene identity, set public to the scene identity of public platform chat scenario.Such as with the instant messaging between two users For message, i.e., by taking the corresponding instant communication message of single chat scene as an example, Key can be named are as follows: core:offline:message: $ username+UUID $, wherein core is the abbreviation of instant communication message correspondence system, and offline indicates that the instant messaging disappears Breath is offline message, and message is single chat scene identity, and username indicates to receive the user of the user of the instant communication message Name, UUID are the Universally Unique Identifier for receiving the instant communication message client.Validity period, corresponding duration can be according to specific It needs and is arranged, such as validity period corresponding duration can be set to 24 hours, 50 hours or 5 days.
Wherein, memory database can be the databases such as Redis and Memcached, be read by the high-performance of memory database Write capability is to reduce the reading and writing data pressure of client.Redis is use ANSI (the American National an of open source Standards Institute, American National Standards Institute (ANSI)) C language writes, support network, it is memory-based also can persistence Log type and Key-Value database, and provide API (the Application Programming of multilingual Interface, application programming interface).Memcached is a set of distributed fast taking system.Non-relational database can For databases such as HBase and Cassandra.HBase be a high reliability, high-performance, towards column, telescopic distribution deposits Storage system.Cassandra is a set of open source distribution NoSQL (Not Only SQL, non-relational database) Database Systems, It is the database of the non-relationship an of mixed type.Such as when memory database is Redis, client is by offline message with Key- The form of Value is written in the ZSET (Sorted Set, ordered set) of Redis.
The present embodiment is received by receiving the message write request of the first client transmission in server-side detecting When the second client that message write request corresponds to message to be written is in off-line state, it is written into message and is determined as disappearing offline Breath, which is written into preset memory database and preset non-relational database, and in memory database It the validity period of middle setting offline message, avoids and stores offline message into the relevant database of server-side, utilize memory The high-performance literacy of database improves the reading efficiency of offline message, and offline message is arranged in memory database Validity period, and offline message is stored to non-relational database, it avoids that offline message being stored in server-side for a long time In deposit data library, on the basis of guaranteeing that user successfully can obtain offline message, depositing for server-side memory database is saved Space is stored up, and improves the reading efficiency of offline message.
Further, the storage method second embodiment of offline message of the present invention is proposed.
The storage method second embodiment of the offline message and the storage method first of the offline message apply the area of example It is not, the storage method of offline message further include:
Step c determines the type of message of the offline message.
After server-side determines offline message, server-side determines the type of message of offline message.Wherein, server-side according to from Scene identity in line message Key is the type of message that can determine offline message.When offline message corresponds to the scene identity in Key For single chat scene scene identity when, server-side can determine offline message be single chat message;When offline message corresponds to the field in Key When scape is identified as the scene identity of group chat scene, server-side can determine that offline message is group chat message;When offline message corresponds to Key In scene identity be public platform chat scenario scene identity when, server-side can determine offline message be public platform chat disappear Breath.It, in other embodiments, can will be offline it should be noted that the embodiment of the present invention does not limit the type of message of offline message Message is set as other types.
It is described that the offline message is written to the step into preset memory database and preset non-relational database Suddenly include:
Offline message classification is written into memory database according to the type of message by step d, and according to institute It states type of message offline message classification is written into non-relational database.
After server-side determines the type of message of offline message, server-side writes offline message classification according to the type of message Enter into the corresponding subdata base of memory database, and offline message classification is written to non-relational number according to the type of message According in the corresponding subdata base in library, i.e., offline message is divided into single chat message, group chat message and public platform chat messages three classes and deposited Storage is in the corresponding subdata base of memory database, and offline message is divided into single chat message, group chat message and public platform and is chatted Its message three classes is stored in the corresponding subdata base of non-relational database, in order to the second client pull it is to be obtained from In line message process, obtained from the subdata base of corresponding types according to the type of message of offline message to be obtained to be obtained offline Message improves the acquisition efficiency that the second client obtains offline message.It should be noted that in memory database and non-relationship In type database, it is respectively arranged with the subdata base that storage different messages type corresponds to offline message, i.e., a kind of type of message pair Answer a subdata base.
Further, the storage method 3rd embodiment of offline message of the present invention is proposed.
The storage method second embodiment of the storage method 3rd embodiment and offline message of the offline message Difference is, the storage method of offline message further include:
Step e, after detecting that the second client successfully logs in, detect in the memory database with the presence or absence of with it is described The corresponding offline message to be obtained of second client.
Second client can be by requesting Login (login) service execution register.When the second client passes through Login It services after successfully logging in, server-side can be detected the second client and successfully log in, at this point, the status indicator of the second client is It is revised as identifying online from offline mark.After server-side detects that the second client successfully logs in, server-side detects memory number According to whether there is offline message to be obtained corresponding with the second client in library, specifically, server-side can be held by Login service Row inquiry instruction, which inquires the second client, whether there is offline message to be obtained.It should be noted that when the success of the second client It logs in, server-side can obtain the user name of second client corresponding UUID and the second client user, if server-side detects Exist into memory database and carry UUID Key corresponding with the user name, server-side, which then can determine in memory database, to be existed Offline message to be obtained corresponding with the second client;If server-side detects not exist in memory database and carries UUID and be somebody's turn to do The corresponding Key of user name, server-side then can determine in memory database in the presence of corresponding with the second client to be obtained offline Message.
Step f, if there are the offline messages to be obtained in the memory database, it is determined that the memory database In, the message number and type of message of the offline message to be obtained.
The type of message and the message number are sent to second client by step g, for second visitor Family end obtains the offline message to be obtained according to the type of message and the message number in the server-side.
If detecting there are offline message to be obtained in memory database, server-side determines to be stored in memory database Offline message to be obtained message number and type of message.Specifically, server-side can be corresponding by offline message to be obtained Key determines the type of message of offline message to be obtained, and the Key quantity by carrying the second client UUID is determined wait obtain Take the message number of offline message, and/or by carry the second client correspond to the Key quantity of user name determine it is to be obtained from The message number of line message.It is understood that the message number of offline message to be obtained, which is equal in memory database, carries the The Key quantity of two client UUID is also equal to carry the Key quantity that the second client corresponds to user name in memory database.When Server-side determines that server-side will be to be obtained offline in memory database after the message number of offline message to be obtained and type of message The message number and type of message of message are sent to the second client, so that the second client is according to the type of message and message count Amount obtains offline message to be obtained in server-side.Wherein, message number can be the total quantity of offline message to be obtained, can also be The corresponding message number of each type of message.
Further, the storage method of offline message further include:
Step h detects the non-relational number if there is no the offline message to be obtained in the memory database According in library whether there is the offline message to be obtained.
If server-side detects there is no offline message to be obtained in memory database, server-side detects non-relational number According in library whether there is offline message to be obtained.It should be noted that whether there is in server-side detection non-relational database The process of offline message to be obtained is similar with the presence or absence of the process of offline message to be obtained in detection memory database, herein not It is described in detail again.
Step i, if there are the offline messages to be obtained in the non-relational database, it is determined that the non-relational In database, the message number and type of message of the offline message to be obtained.
The type of message and the message number are sent to second client by step j, for second visitor Family end obtains the offline message to be obtained according to the type of message and the message number in the server-side.
If detecting, there are offline message to be obtained in non-relational database, server-side determines non-relational database In offline message to be obtained message number and type of message, and the message number of offline message to be obtained and type of message are sent out Give the second client, for the second client obtained in server-side according to the type of message and message number it is to be obtained offline Message.It should be noted that server-side determines the message number and type of message of offline message to be obtained in non-relational data Process and server-side determine that the message number of offline message to be obtained and the process of type of message are similar in memory database, This is no longer described in detail.Further, if there is no offline message to be obtained in detection non-relational database, server-side is given birth to There are the prompt informations of offline message by Cheng Wei, and the prompt information is sent to the second client, for the second client according to The prompt information, which determines, does not have offline message in server-side.Wherein, after the second client receives offline message, the second visitor Family end can show that the prompt information, the second client also may be selected not showing the prompt information in its display interface.
The present embodiment passes through when detect that the second client successfully logs in after, if detecting in memory database in the presence of with the The corresponding offline message to be obtained of two clients, it is determined that the message number and message of offline message to be obtained in memory database Type;If detecting, there is no offline messages to be obtained corresponding with the second client in memory database, but detect non-pass It is that there are offline messages to be obtained in type database, it is determined that the message number of offline message to be obtained in non-relational database And type of message, and type of message and message number are sent to the second client, so that the second client is according to type of message Offline message to be obtained is obtained in server-side with message number, improves the success that the second client successfully obtains offline message Rate, and by preferentially detecting whether that, there are offline message to be obtained, improving in detection service end is in memory database It is no that there are the detection efficiencies of offline message to be obtained.
Further, the storage method fourth embodiment of offline message of the present invention is proposed.
The storage method 3rd embodiment of the storage method fourth embodiment and offline message of the offline message Difference is, the storage method of offline message further include:
Step k is requested when receiving second client by the data pull that hypertext transfer protocol HTTP is sent Afterwards, according to the data pull request corresponding device identification and type of message by second client it is corresponding it is to be obtained from Line message is sent to second client.
After the second client receives the message number and type of message of the offline message to be obtained of server-side transmission, the Two clients can be obtained in server-side to be obtained by UM (User Management, Subscriber Management System) and messaging service Offline message.Specifically, the second client passes through HTTP (Hyper Text Transfer Protocol, Hyper text transfer association Discuss) connection is established with server-side, and data pull request is generated after establishing connection by HTTP and server-side, that is, generate pull Request, by the data pull request be sent to server-side, in server-side according to the data pull request it is to be obtained from Line message.UM is for safeguarding user related information.
After server-side receives the data pull request of the second client transmission, server-side is requested according to the data pull The corresponding offline message to be obtained of second client is sent to the second client by corresponding device identification and type of message.It can be with Understand, the quantity for the offline message to be obtained that the second client is pulled from server-side is equal to server-side and is sent to the second visitor The message number at family end.During the second client pulls offline message to be obtained from server-side, the second client can be It determines and is pulled in type of message and the corresponding database of message number, i.e., obtained in the database for storing offline message to be obtained Offline message to be obtained, to improve the efficiency for obtaining offline message in server-side, at this point, server-side is sent to the second client Type of message and message number in carry corresponding database name, the second client can determine by the database name to disappear Cease type and the corresponding database of message number.
Further, in order to improve the acquisition efficiency that the second client obtains offline message to be obtained, the second client can Offline message to be obtained is obtained in corresponding subdata base according to type of message.
It in the prior art, is that server-side requests offline message being sent to the second client using push (push), The long connection of client can be occupied in push request transmission process, normally send to influence offline message, offline message is caused to prolong It is sent to the second client late.And the present embodiment actively uses pull request to obtain offline from server-side by the second client Message, and pull request is that server-side is sent to by HTTP, is not to be connected using long, avoids the second client and delay obtaining The case where offline message, occurs, and improves the acquisition efficiency of offline message.
Further, the 5th embodiment of storage method of offline message of the present invention is proposed.
The storage method first, second of the storage method fourth embodiment of the offline message and the offline message, the Three or the difference of fourth embodiment be, referring to Fig. 2, the storage method of offline message further include:
Step S40, detects whether second client pulls institute within the validity period from the memory database State offline message.
Step S50, if second client do not pulled from the memory database within the validity period it is described from Line message then deletes the offline message in the memory database.
After server-side stores offline message into memory database, server-side is in real time or timing detects the second client Whether end pulls the offline message from memory database before the deadline.If detect the second client not before the deadline from Offline message is pulled in memory database, server-side then deletes the offline message in memory database;If detecting the second client End pulls offline message, the server-side then success from memory database in the second client from memory database before the deadline After pulling offline message, the offline message in memory database is deleted.
The present embodiment is by deleting when the second client does not pull offline message from memory database before the deadline Offline message in memory database avoids offline message and is stored in memory database for a long time, occupies the interior of server-side It deposits, improves the utilization rate of the memory headroom of server-side.
In addition, the present invention also provides a kind of storage device of offline message, the storage of the offline message fills referring to Fig. 3 It sets and includes:
Detection module 10, after for receiving the message write request of the first client transmission when server-side, detection is received Whether the second client of the corresponding message to be written of the message write request is in off-line state;
Determining module 20, if for detecting that second client is in off-line state, by the message to be written It is determined as offline message;
Writing module 30, for being written the offline message to preset memory database and preset non-relational number According in library;
Setup module 40, for the validity period of the offline message to be arranged in the memory database.
Further, the determining module 20 is also used to determine the type of message of the offline message;
The write module 30 is also used to that offline message classification is written to preset interior according to the type of message In deposit data library, and the offline message is classified according to the type of message and is written to preset non-relational database In.
Further, the detection module 10 is also used to after detecting that the second client successfully logs in, and is detected in described It whether there is offline message to be obtained corresponding with second client in deposit data library;
If the determining module 20 is also used in the memory database, there are the offline messages to be obtained, it is determined that institute It states in memory database, the message number and type of message of the offline message to be obtained;
The storage device of the offline message further include:
Sending module, for the type of message and the message number to be sent to second client, for institute It states the second client and described to be obtained disappear offline is obtained in the server-side according to the type of message and the message number Breath.
Further, if the detection module 10 is also used to not exist in the memory database described to be obtained disappear offline Breath then detects in the non-relational database with the presence or absence of the offline message to be obtained;
If the determining module 20 is also used in the non-relational database, there are the offline messages to be obtained, really In the fixed non-relational database, the message number and type of message of the offline message to be obtained.
Further, the sending module, which is also used to that second client ought be received, passes through hypertext transfer protocol After the data pull request that HTTP is sent, request corresponding device identification and type of message by described the according to the data pull The corresponding offline message to be obtained of two clients is sent to second client.
Further, the detection module 10 be also used to detect second client whether within the validity period from institute It states and pulls the offline message in memory database;
The storage device of the offline message further include:
Removing module, if not pulling institute from the memory database within the validity period for second client Offline message is stated, then deletes the offline message in the memory database.
Further, the detection module 10 includes:
Acquiring unit obtains after for receiving the message write request of the first client transmission when server-side and receives institute State the status indicator that message write request corresponds to the second client of message to be written;
Detection unit, for detecting whether the status indicator is to identify offline;
Determination unit, if for detecting that the status indicator is offline mark, it is determined that second client is in Off-line state.
It should be noted that the storage method of each embodiment of the storage device of offline message and above-mentioned offline message Each embodiment is essentially identical, and in this not go into detail.
In addition, the present invention also provides a kind of server-sides.As shown in figure 4, Fig. 4 is the hardware that the embodiment of the present invention is related to The structural schematic diagram of running environment.
It should be noted that Fig. 4 can be the structural schematic diagram of the hardware running environment of server-side.Clothes of the embodiment of the present invention Business end can be PC, the terminal devices such as portable computer.
As shown in figure 4, the server-side may include: processor 1001, such as CPU, memory 1005, user interface 1003, network interface 1004, communication bus 1002.Wherein, communication bus 1002 is logical for realizing the connection between these components Letter.User interface 1003 may include display screen (Display), input unit such as keyboard (Keyboard), and optional user connects Mouth 1003 can also include standard wireline interface and wireless interface.Network interface 1004 optionally may include the wired of standard Interface, wireless interface (such as WI-FI interface).Memory 1005 can be high speed RAM memory, be also possible to stable memory (non-volatile memory), such as magnetic disk storage.Memory 1005 optionally can also be independently of aforementioned processor 1001 storage device.
Optionally, server-side can also include camera, RF (Radio Frequency, radio frequency) circuit, sensor, sound Frequency circuit, WiFi module etc..
It will be understood by those skilled in the art that service end structure shown in Fig. 4 does not constitute the restriction to server-side, it can To include perhaps combining certain components or different component layouts than illustrating more or fewer components.
As shown in figure 4, as may include that operating system, network are logical in a kind of memory 1005 of computer storage medium Believe the storage program of module, Subscriber Interface Module SIM and offline message.Wherein, operating system is to manage and control server-side hardware With the program of software resource, the storage program of offline message and the operation of other softwares or program are supported.
In server-side shown in Fig. 4, user interface 1003 is mainly used for connecting the first client and the second client, with The first client and the second client carry out data communication;Network interface 1004 is mainly used for background server, with background service Device carries out data communication;Processor 1001 can be used for calling the storage program of the offline message stored in memory 1005, and The step of executing the storage method of offline message as described above.
Each embodiment of storage method of server-side specific embodiment of the present invention and above-mentioned offline message is essentially identical, herein It repeats no more.
In addition, the embodiment of the present invention also proposes a kind of computer readable storage medium, the computer readable storage medium On be stored with the storage program of offline message, realized when the storage program of the offline message is executed by processor as described above The step of storage method of offline message.
Each embodiment of storage method of computer readable storage medium specific embodiment of the present invention and above-mentioned offline message Essentially identical, details are not described herein.
It should be noted that, in this document, the terms "include", "comprise" or its any other variant are intended to non-row His property includes, so that the process, method, article or the device that include a series of elements not only include those elements, and And further include other elements that are not explicitly listed, or further include for this process, method, article or device institute it is intrinsic Element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that including being somebody's turn to do There is also other identical elements in the process, method of element, article or device.
The serial number of the above embodiments of the invention is only for description, does not represent the advantages or disadvantages of the embodiments.
Through the above description of the embodiments, those skilled in the art can be understood that above-described embodiment side Method can be realized by means of software and necessary general hardware platform, naturally it is also possible to by hardware, but in many cases The former is more preferably embodiment.Based on this understanding, technical solution of the present invention substantially in other words does the prior art The part contributed out can be embodied in the form of software products, which is stored in a storage medium In (such as ROM/RAM, magnetic disk, CD), including some instructions are used so that a terminal device (can be mobile phone, computer, clothes Business device, air conditioner or the network equipment etc.) execute method described in each embodiment of the present invention.
The above is only a preferred embodiment of the present invention, is not intended to limit the scope of the invention, all to utilize this hair Equivalent structure or equivalent flow shift made by bright specification and accompanying drawing content is applied directly or indirectly in other relevant skills Art field, is included within the scope of the present invention.

Claims (15)

1. a kind of storage method of offline message, which is characterized in that the storage method of the offline message the following steps are included:
After server-side receives the message write request of the first client transmission, it is corresponding that detection receives the message write request The second client of message to be written whether be in off-line state;
If detecting, second client is in off-line state, and the message to be written is determined as offline message;
The offline message is written into preset memory database and preset non-relational database, and in the memory The validity period of the offline message is set in database.
2. the storage method of offline message as described in claim 1, which is characterized in that if described detect second client After the step of end is in off-line state, then the message to be written is determined as offline message, further includes:
Determine the type of message of the offline message;
It is described that the offline message is written to the step packet into preset memory database and preset non-relational database It includes:
Offline message classification write-in is disappeared into preset memory database, and according to described according to the type of message It ceases type offline message classification is written into preset non-relational database.
3. the storage method of offline message as claimed in claim 2, which is characterized in that described to set in the memory database After the step of setting the validity period of the offline message, further includes:
After detecting that the second client successfully logs in, detecting in the memory database whether there is and second client Corresponding offline message to be obtained;
If there are the offline messages to be obtained in the memory database, it is determined that described wait obtain in the memory database Take the message number and type of message of offline message;
The type of message and the message number are sent to second client, so that second client is according to institute It states type of message and the message number obtains the offline message to be obtained in the server-side.
4. the storage method of offline message as claimed in claim 3, which is characterized in that it is described when detect the second client at After function logs in, the step that whether there is offline message to be obtained corresponding with second client in the memory database is detected After rapid, further includes:
If there is no the offline message to be obtained in the memory database, detect in the non-relational database whether There are the offline messages to be obtained;
If there are the offline messages to be obtained in the non-relational database, it is determined that in the non-relational database, The message number and type of message of the offline message to be obtained;
The type of message and the message number are sent to second client, so that second client is according to institute It states type of message and the message number obtains the offline message to be obtained in the server-side.
5. the storage method of offline message as claimed in claim 3, which is characterized in that described by the type of message and described Message number was sent to after the step of second client, further includes:
After receiving the data pull request that second client is sent by hypertext transfer protocol HTTP, according to described Data pull requests corresponding device identification and type of message to send the corresponding offline message to be obtained of second client To second client.
6. the storage method of offline message as described in claim 1, which is characterized in that it is described by the offline message be written to In preset memory database and preset non-relational database, and the offline message is set in the memory database Validity period the step of after, further includes:
Detect whether second client pulls the offline message within the validity period from the memory database;
If second client does not pull the offline message within the validity period from the memory database, delete Offline message in the memory database.
7. such as the storage method of offline message as claimed in any one of claims 1 to 6, which is characterized in that described when service termination After the message write request for receiving the transmission of the first client, detection receives the corresponding message to be written of the message write request The step of whether the second client is in off-line state include:
After server-side receives the message write request of the first client transmission, it is corresponding to obtain the reception message write request The status indicator of second client of message to be written, and detect whether the status indicator is to identify offline;
If detecting, the status indicator is offline mark, it is determined that second client is in off-line state.
8. a kind of storage device of offline message, which is characterized in that the storage device of the offline message includes:
Detection module after for receiving the message write request of the first client transmission when server-side, disappears described in detection reception Whether the second client of the corresponding message to be written of breath write request is in off-line state;
Determining module, if being determined as the message to be written for detecting that second client is in off-line state Offline message;
Writing module, for being written the offline message to preset memory database and preset non-relational database In;
Setup module, for the validity period of the offline message to be arranged in the memory database.
9. the storage device of offline message as claimed in claim 8, which is characterized in that the determining module is also used to determine institute State the type of message of offline message;
The write module is also used to that offline message classification is written to preset internal storage data according to the type of message In library, and the offline message is classified according to the type of message and is written into preset non-relational database.
10. the storage device of offline message as claimed in claim 9, which is characterized in that the detection module is also used to when inspection Measure after the second client successfully logs in, detect in the memory database with the presence or absence of it is corresponding with second client to Obtain offline message;
If the determining module is also used in the memory database, there are the offline messages to be obtained, it is determined that the memory In database, the message number and type of message of the offline message to be obtained;
The storage device of the offline message further include:
Sending module, for the type of message and the message number to be sent to second client, for described Two clients obtain the offline message to be obtained according to the type of message and the message number in the server-side.
11. the storage device of offline message as claimed in claim 10, which is characterized in that if the detection module is also used to institute It states in memory database and there is no the offline message to be obtained, then detect in the non-relational database with the presence or absence of described Offline message to be obtained;
If the determining module is also used in the non-relational database, there are the offline messages to be obtained, it is determined that described In non-relational database, the message number and type of message of the offline message to be obtained.
12. the storage device of offline message as claimed in claim 10, which is characterized in that the sending module is also used to work as and connect After receiving the data pull request that second client is sent by hypertext transfer protocol HTTP, according to the data pull Request corresponding device identification and type of message that the corresponding offline message to be obtained of second client is sent to described Two clients.
13. the storage device of offline message as claimed in claim 8, which is characterized in that the detection module is also used to detect Whether second client pulls the offline message within the validity period from the memory database;
The storage device of the offline message further include:
Removing module, if do not pulled from the memory database within the validity period for second client it is described from Line message then deletes the offline message in the memory database.
14. a kind of server-side, which is characterized in that the server-side includes memory, processor and is stored on the memory And the storage program for the offline message that can be run on the processor, the storage program of the offline message is by the processor The step of storage method of the offline message as described in any one of claims 1 to 7 is realized when execution.
15. a kind of computer readable storage medium, which is characterized in that be stored on the computer readable storage medium and disappear offline The storage program of breath is realized when the storage program of the offline message is executed by processor such as any one of claims 1 to 7 institute The step of storage method for the offline message stated.
CN201910460917.2A 2019-05-29 2019-05-29 Storage method, device, server-side and the readable storage medium storing program for executing of offline message Pending CN110198351A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910460917.2A CN110198351A (en) 2019-05-29 2019-05-29 Storage method, device, server-side and the readable storage medium storing program for executing of offline message

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910460917.2A CN110198351A (en) 2019-05-29 2019-05-29 Storage method, device, server-side and the readable storage medium storing program for executing of offline message

Publications (1)

Publication Number Publication Date
CN110198351A true CN110198351A (en) 2019-09-03

Family

ID=67753409

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910460917.2A Pending CN110198351A (en) 2019-05-29 2019-05-29 Storage method, device, server-side and the readable storage medium storing program for executing of offline message

Country Status (1)

Country Link
CN (1) CN110198351A (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111371854A (en) * 2020-02-24 2020-07-03 南京甄视智能科技有限公司 Method and device for sending offline message in Internet of things, storage medium and server
CN111643892A (en) * 2020-05-29 2020-09-11 上海米哈游天命科技有限公司 Message processing method, device, equipment and storage medium
CN112416598A (en) * 2020-12-01 2021-02-26 网易(杭州)网络有限公司 Message processing method and device, electronic equipment and storage medium
CN112769876A (en) * 2019-10-21 2021-05-07 浙江宇视科技有限公司 Method, device, equipment and medium for acquiring equipment channel information
CN113157466A (en) * 2021-04-27 2021-07-23 上海销氪信息科技有限公司 Message pushing method, device, system, electronic equipment and storage medium
CN115348231A (en) * 2022-08-17 2022-11-15 北京蔚领时代科技有限公司 Message processing method, device, server and storage medium
CN115412520A (en) * 2022-09-04 2022-11-29 成都优啊网络科技有限公司 Method for storing, reading and writing interaction of Instant Messaging (IM) chat data

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20060070339A (en) * 2004-12-20 2006-06-23 한국전자통신연구원 Presence server based on sip and control method for the same
CN102355426A (en) * 2011-06-30 2012-02-15 北京神州泰岳软件股份有限公司 Method for transmitting off-line file and system
CN103546437A (en) * 2012-07-16 2014-01-29 中兴通讯股份有限公司 Method, UE (user equipment) and AS (application server) for transceiving offline messages in IMS (IP multimedia system)
CN106656763A (en) * 2016-12-29 2017-05-10 北京奇虎科技有限公司 Method and device for sending offline message
CN108768775A (en) * 2018-05-30 2018-11-06 努比亚技术有限公司 Information processing method, electronic equipment and computer storage media

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20060070339A (en) * 2004-12-20 2006-06-23 한국전자통신연구원 Presence server based on sip and control method for the same
CN102355426A (en) * 2011-06-30 2012-02-15 北京神州泰岳软件股份有限公司 Method for transmitting off-line file and system
CN103546437A (en) * 2012-07-16 2014-01-29 中兴通讯股份有限公司 Method, UE (user equipment) and AS (application server) for transceiving offline messages in IMS (IP multimedia system)
CN106656763A (en) * 2016-12-29 2017-05-10 北京奇虎科技有限公司 Method and device for sending offline message
CN108768775A (en) * 2018-05-30 2018-11-06 努比亚技术有限公司 Information processing method, electronic equipment and computer storage media

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112769876A (en) * 2019-10-21 2021-05-07 浙江宇视科技有限公司 Method, device, equipment and medium for acquiring equipment channel information
CN112769876B (en) * 2019-10-21 2023-04-07 浙江宇视科技有限公司 Method, device, equipment and medium for acquiring equipment channel information
CN111371854A (en) * 2020-02-24 2020-07-03 南京甄视智能科技有限公司 Method and device for sending offline message in Internet of things, storage medium and server
CN111643892A (en) * 2020-05-29 2020-09-11 上海米哈游天命科技有限公司 Message processing method, device, equipment and storage medium
CN112416598A (en) * 2020-12-01 2021-02-26 网易(杭州)网络有限公司 Message processing method and device, electronic equipment and storage medium
CN112416598B (en) * 2020-12-01 2023-07-25 网易(杭州)网络有限公司 Message processing method, device, electronic equipment and storage medium
CN113157466A (en) * 2021-04-27 2021-07-23 上海销氪信息科技有限公司 Message pushing method, device, system, electronic equipment and storage medium
CN115348231A (en) * 2022-08-17 2022-11-15 北京蔚领时代科技有限公司 Message processing method, device, server and storage medium
CN115348231B (en) * 2022-08-17 2023-12-12 北京蔚领时代科技有限公司 Message processing method, device, server side and storage medium
CN115412520A (en) * 2022-09-04 2022-11-29 成都优啊网络科技有限公司 Method for storing, reading and writing interaction of Instant Messaging (IM) chat data

Similar Documents

Publication Publication Date Title
CN110198351A (en) Storage method, device, server-side and the readable storage medium storing program for executing of offline message
CN108897691B (en) Data processing method, device, server and medium based on interface simulation service
US9037555B2 (en) Asynchronous collection and correlation of trace and communications event data
EP3298559A1 (en) Interactive command line for content creation
US20110161989A1 (en) Dynamic program integration
CN112311656B (en) Message aggregation and display method and device, electronic equipment and computer readable medium
CN109614270A (en) Data read-write method, device, equipment and storage medium based on Hbase
CN110505072B (en) Method, terminal device and computer readable medium for backing up chat records
CN109614271A (en) Control method, device, equipment and the storage medium of multiple company-data consistency
CN108459910A (en) A kind of method and apparatus for deleting resource
WO2022142536A1 (en) Grayscale publishing method, system and apparatus, and device and storage medium
CN113190517A (en) Data integration method and device, electronic equipment and computer readable medium
CN112181393A (en) Front-end and back-end code generation method and device, computer equipment and storage medium
CN111488386A (en) Data query method and device
US11870746B2 (en) Method for chatting messages by topic based on subscription channel reference in server and user device
CN114390239A (en) Communication method, device, system, electronic device, and storage medium
CN112966201B (en) Object processing method, device, electronic equipment and storage medium
CN115017149A (en) Data processing method and device, electronic equipment and storage medium
CN110262912B (en) Calling method and device for procedure call gRPC
CN113342759A (en) Content sharing method, device, equipment and storage medium
CN112363782A (en) Chat interface display method and device, electronic equipment and computer readable medium
US20230353522A1 (en) Message capture in a multi channel communication environment
CN112822089A (en) Method and device for adding friends
CN111771191A (en) Cross-domain inline event handler
WO2023230797A1 (en) Cross-system test method and apparatus

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