CN105337973A - Message exchange method and system - Google Patents
Message exchange method and system Download PDFInfo
- Publication number
- CN105337973A CN105337973A CN201510705356.XA CN201510705356A CN105337973A CN 105337973 A CN105337973 A CN 105337973A CN 201510705356 A CN201510705356 A CN 201510705356A CN 105337973 A CN105337973 A CN 105337973A
- Authority
- CN
- China
- Prior art keywords
- message
- client side
- information client
- server
- 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.)
- Granted
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L63/00—Network architectures or network communication protocols for network security
- H04L63/08—Network architectures or network communication protocols for network security for authentication of entities
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L51/00—User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
- H04L51/04—Real-time or near real-time messaging, e.g. instant messaging [IM]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/14—Session management
- H04L67/141—Setup of application sessions
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer Hardware Design (AREA)
- Computer Security & Cryptography (AREA)
- Computing Systems (AREA)
- General Engineering & Computer Science (AREA)
- Computer And Data Communications (AREA)
- Information Transfer Between Computers (AREA)
Abstract
The invention discloses a message exchange method and a message exchange system. The message exchange method comprises the steps that: (1) a message client sends a TCP protocol handshake request to a message server; (2) the message server returns a handshake response to the message client to establish a long-term effective link; (3) the message client sends a user login request to the message server, wherein the login request message contains a token; (4) the message server receives the login request message and verifies the user; (5) and the message server saves connection state of the user when judging that the user is a legitimate user, and returns a user identifier ID of the user to the message client, so as to allow communication between the message client and the message server. The message exchange method and the message exchange system can ensure that the physical link is open for a long time when uses exchange messages, can guarantee that the users can perform real-time exchange, and provide a compensation mechanism when the physical link is unstable, so as to ensure that the transmitted messages are reliable and complete.
Description
Technical field
The present invention relates to communication technique field, particularly relate to a kind of method for message interaction and system thereof.
Background technology
Along with the high speed development of Internet technology, people pass through to use Internet to carry out document backup, information broadcast, Long-distance Control and interacting message etc. in many occasions (such as company, school, family, open air etc.).Especially in some large enterprises, message interactive between internal staff and external client very frequently, and prior art completes data syn-chronization between client-server by timing JOB or demand poll, therefore, lack the real-time communication mechanism between a kind of client-server or between server-server, and then data when also cannot ensure interacting message can arrive at the destination safely and reliably.Moreover along with the continuous growth of customer volume, the interaction between user proposes larger challenge to the real-time of message and reliability.
Summary of the invention
In order to solve the problem, the invention provides a kind of method for message interaction and system thereof, it can not only ensure that the physical link of user when carrying out interacting message is opened for a long time, and ensures that user can carry out the mutual of real-time, avoids because of number of users caused latency issue more; Moreover, when physical link is unstable, also provide a kind of compensation mechanism, to ensure that transmitted message is reliable, complete.
According to an aspect of of the present present invention, provide a kind of method for message interaction, said method comprising the steps of: (1) information client side sends the handshake request of Transmission Control Protocol to message server; (2) message server returns a handshake response to information client side, to set up a permanently effective link; (3) information client side sends user's logging request to message server, and containing Token token in login request message; (4) message server receives described login request message, and carries out user rs authentication; (5) when determining described user for validated user, message server preserves the connection status of described user, return the user ID ID of described user to described information client side, to allow to carry out communication between described information client side and described message server simultaneously.
According to another aspect of the present invention, additionally provide a kind of message exchange system, described system comprises: handshake request unit, for sending the handshake request of Transmission Control Protocol to message server from information client side; Handshake response unit, for returning a handshake response from message server to information client side, to set up a permanently effective link; Logging request unit, for sending user's logging request to message server from information client side, and containing Token token in login request message; User authentication unit, for making message server receive described login request message, and carries out user rs authentication; Unit is set up in communication, for when determining described user for validated user, message server preserves the connection status of described user, returns the user ID ID of described user to described information client side, to allow to carry out communication between described information client side and described message server simultaneously.
The invention has the advantages that, a kind of method for message interaction and system thereof are provided, when not relying on poll or timing, it can not only ensure that user carries out long interacting message in the effective situation of physical link, and ensure that user can carry out the mutual of real-time, avoid because of number of users caused time delay or loss problem more; Moreover, when physical link is unstable, also provide a kind of compensation mechanism, to ensure that message safety reliably arrives at the destination.In addition, described message exchange system also supports the interacting message between multiple client (such as mobile terminal, mobile phone terminal, PC end etc.).
Accompanying drawing explanation
According to hereafter by reference to the accompanying drawings to the detailed description of the specific embodiment of the invention, those skilled in the art will understand the present invention above-mentioned and other objects, advantage and feature more.
By reading the detailed description of following detailed description, various other advantage and benefit will become cheer and bright for those of ordinary skill in the art.Accompanying drawing only for illustrating the object of embodiment, and does not think limitation of the present invention.And in whole accompanying drawing, represent identical parts by identical reference symbol.
Fig. 1 is the steps flow chart schematic diagram of method for message interaction described in one embodiment of the invention;
Fig. 2 is the configuration diagram of message exchange system described in one embodiment of the invention;
Fig. 3 is the configuration diagram of message exchange system described in another embodiment of the present invention;
Fig. 4 is the configuration diagram of message exchange system described in another embodiment of the present invention;
Fig. 5 is the configuration diagram of message exchange system described in another embodiment of the present invention;
Fig. 6 is the configuration diagram of the local lower unit of message in another embodiment of the present invention;
Fig. 7 is the configuration diagram of message exchange system described in another embodiment of the present invention;
Fig. 8 is the configuration diagram of message exchange system described in another embodiment of the present invention;
Fig. 9 is the configuration diagram of message exchange system described in another embodiment of the present invention.
Embodiment
Below with reference to the accompanying drawings exemplary embodiment of the present invention is described in more detail.Although show exemplary embodiment of the present invention in accompanying drawing, but should be appreciated that and can realize the present invention in a variety of manners and not answer the restriction of set forth embodiment.On the contrary, provide these embodiments to be in order to more thoroughly the present invention can be understood, and scope of the present invention intactly can be conveyed to those skilled in the art.
Shown in Figure 1, the invention provides a kind of method for message interaction, comprising:
Step S110: information client side sends the handshake request of Transmission Control Protocol to message server.
Step S120: message server returns a handshake response to information client side, to set up a permanently effective link.
In step S110 and step S120, the respective port arranging information client side and message server is open mode, and when there is physical link disconnection between information client side and message server, described information client side automatically can initiatively connect described message server, thus ensure that signaling link is between the two communicated with, and then can make to carry out real-time working between message server and multiple information client side, link 100% reliable, and communication time delay is between the two less.That is, prior art adopts short link mode, namely after link request, within a short period of time just closes, with Deterministic service device without performance bottleneck problem, but produce loss when adopting short link mode, message could can only send in connection situation, and when occurring that physical link disconnects (timeout), other modes are needed to compensate, whole execution mode more complicated.And the application sets up long link (namely link is opened for a long time) by Transmission Control Protocol, and then can the state of real-time listening information client side and message server.Because the TCP standard that is established as of initial physical link connects (three-way handshake agreement), thus ensure that the message transmitted between information client side and message server is reliable and complete.
Step S130: information client side sends user's logging request to message server, and containing Token token in login request message.
Step S140: message server receives described login request message, and carry out user rs authentication.
Step S150: when determining described user for validated user, message server preserves the connection status of described user, return the user ID ID of described user to described information client side, to allow to carry out communication between described information client side and described message server simultaneously.
In step S130 in step S150, information client side sends user's logging request to message server.Described message server by the token token passing in login request message in login authentication server, to carry out inquiring and authenticating.Be disabled user when determining user, then return an authentication failed message to described information client side, force the long link (namely permanently effective link) of closing the border between described information client side and described message server simultaneously, and play except this disabled user.When determining described user for validated user, preserving the connection status of user, and this connection status being sent to message router, to register the User Status of this validated user; And described message server returns one and contains the message of user ID ID to described information client side, to allow to carry out carrying out communication between described information client side and described message server.Described information client side keeps in described user ID ID, carries this user ID ID during in order to carry out interacting message.
In the present embodiment, comprise further after the step s 150: step (61), described information client side receive the message that user inputs, and described message are sent to the message server be connected with described information client side; Step (62), described message server are searched in the local message client be connected with described message server according to the receiving terminal ID in described message; Step (63), when described message server finds corresponding local message client according to the receiving terminal ID in described message, described message is sent to corresponding local message client by described message server.
Wherein, described information client side is when receiving the message that an information client side (such as A end) sends, first search in the local message client be connected with described message server according to the receiving terminal ID in described message, when found, described message is sent to corresponding local message client (such as B end) by described message server.Optionally, described message server according to the receiving terminal ID in described message to find corresponding local message client in the local message client that described message server is connected after, comprise further: step (631), described message server calculate described information client side preset the very first time in access times; Step (632), when described information client side preset the very first time in access times more than a predetermined threshold value time, then described message server sends a limiting access message to described information client side, and stops sending described message to receiving terminal.By performing step (631) and step (632), can prevent described information client side from excessively sending the problem of message (namely sending message frequency too high), only when satisfied restriction regulation, message normally could be sent to receiving terminal by described information client side.
In the present embodiment, after step (62), comprise further: step (64), when described message server does not find corresponding local message client according to the receiving terminal ID in described message, described message server goes to message router by described message; Step (65), described message router according to the receiving terminal ID in described message by described Message routing to corresponding strange land message server; Step (66), described strange land message server search corresponding strange land information client side according to the receiving terminal ID in described message, and described message is sent to corresponding strange land information client side.
100,000 users (preferential 5 ~ 8 general-purpose families) can be carried due to general message service device and consider that number of users can increase gradually, therefore, by distributed arrangement, message server is installed the equipment (i.e. message router) with routing function.Described message server and message router carry out long link and are connected, between each message router and message server by unique identification to distinguish message server and message router.This unique identification can for distributed number section.That is, the interactive mode between described message router and described message server is to carry out interacting message with synchronous by a number section matching method (or claiming geographical cover).The grade of multiple message router is sane level, but not the superior and the subordinate.In the present embodiment, described message router and described message server can be all distributed deployments.The routing rule of described message router can be similar with the routing rule of physical router.Each message router can corresponding multiple message server.Equally, each message server also can corresponding multiple message router.Described message server type comprises the message server of tcpsocket interface and the message server (this message server adopts html5 agreement, can be mutual with browser) of websocket interface.Described message server loads on the enterprising news that work of described message router, and such as web page user can carry out communication with other users of message server rear end (PC holds), and by message router to realize the object of transfer message.After execution above-mentioned steps (62), namely message server judges that receiving terminal ID in received described message and current message service device identify inconsistent, namely show that receiving terminal is not home messaging server, so described message is uploaded to described message router by described message server, described router by built-in routing table and receiving terminal ID to determine described message to be issued to corresponding strange land message server, this corresponding strange land message server after receiving the message, search corresponding strange land information client side, and push described message to corresponding strange land information client side.Preferably, among step (65), comprise further: step (651), when described message router by described Message routing to corresponding strange land message server time, find that corresponding strange land information client side is in off-line state, then described message is sent to offline service device to preserve; Step (652), when described offline service device determine described strange land information client side be in line states time, then preserved described message is sent to described strange land message server by described offline service device, and is forwarded to corresponding strange land information client side.
Specifically, time when user's off-line of receiving terminal or not on current strange land message server, described message is considered as deferred information by described message router, and by described message stores in offline service device.When the user of receiving terminal is again online, except again setting up except physical link, the deferred information sent to online other users of period from off-line will be received, thus ensure the reliable, complete of message.
To sum up, when carrying out interacting message between two information client sides being connected to same message server, only need to be transmitted by user ID ID, do not need to pass through message router.And when carrying out interacting message between two information client sides being connected to different messages server, carry out needing message router when message forwards.Described message router can forward the message to sane level corresponding strange land message server.
In addition, except described message server is connected with described message router, described message server also can be connected with service server.Upon request by a user, send special instruction to service server, the related personnel of described service server rear end loads some Business Processing in real time by programming mode on described service server, so the information extraction from network of relation of described service server, and feed back corresponding information intelligently.
In other embodiments of the invention, after the step s 150, comprise further: step (71), described information client side send one and exit session request to described message server; Step (72), described message server remove the User Status of respective user, and send one and exit conversational response to described information client side, wherein saidly exit in conversational response containing exiting mark; The synchronization routing device request that simultaneously sends to message router, to delete the User Status of respective user.
In an embodiment of the present invention, in step S120 and step S130, comprise further: step (81), described information client side send heartbeat request to described message server, to show that described information client side is in state of activation at interval of the second time; When step (82), described message server do not receive heartbeat request within the second time, be then considered as described information client side and be in off-line state, force to disconnect the permanently effective link between described information client side simultaneously; Step (83), when the permanently effective link that described information client side finds between described message server is off, resend the handshake request of Transmission Control Protocol to described message server, to re-establish permanently effective link.
By above-mentioned steps (81) to the enforcement of step (83), the permanently effective of the physical link between information client side and message server can be ensured, and be in stable state.
In an embodiment of the present invention, after the step s 150, comprise further: step (91), after described information client side sends at least one message and after the 3rd time of presetting, described information client side sends a message sink and confirms that request is to described message server; The message vector corresponding with the last item message received by described message server that step (92), described information client side receive that described message server returns, and the message vector corresponding with the last item message that the described information client side stored sends compares; Step (93), do not receive part messages (that is, two message vector values are inconsistent) when described information client side determines described message server, then described information client side resends described part messages; Step (94), after described message server sends at least one message and after the 4th time of presetting, described message server sends a message sink and confirms that request is to described information client side; The message vector corresponding with the last item message received by described information client side that step (95), described message server receive that described information client side returns, and the message vector corresponding with the last item message that the described message server stored sends compares; Step (96), do not receive part messages (that is, two message vector values are inconsistent) when described message server determines described information client side, then described message server resends described part messages.
Specifically, whether normally receive and dispatch in order to ensure message, do not consider system level under normal circumstances, only consider application, when transmitting terminal sends a request to receiving terminal each time, receipt is to described transmitting terminal in the response lag preset for described receiving terminal, and to show whether receiving terminal receives message, wherein said response lag can define in the communication format of described message.In embodiments of the invention, during when physical link shake, chain rupture or at Internet Transmission, message data may be lost, so adopt based on the compensation mechanism of Transmission Control Protocol, to ensure the stability of message data.Described in above-mentioned steps (91) to step (96), described message server can preserve the message vector that described information client side sends at every turn, equally, described information client side preserves the message vector that described message server sends at every turn too.When automatically reconnecting after long link disconnects, namely after described information client side and described message server successful handshake, both can compare message vector, if when finding that there is information drop-out, the part messages then the other side do not received is reissued again to the other side, thus ensure that described information client side and the data of described message server on physical link are complete, and do not lose.
Therefore, a kind of method for message interaction provided by the present invention, when not relying on poll or timing, can not only ensure that user carries out long interacting message in the effective situation of physical link, and ensure that user can carry out the mutual of real-time, avoid because of number of users caused time delay or loss problem more; Moreover, when physical link is unstable, also provide a kind of compensation mechanism, to ensure that message safety reliably arrives at the destination.
See Fig. 2, the present invention also provides a kind of message exchange system, comprising: unit 330 is set up in handshake request unit 210, handshake response unit 310, logging request unit 220, user authentication unit 320 and communication.Wherein, described handshake request unit 210 is for sending the handshake request of Transmission Control Protocol to message server 300 from information client side 200; Described handshake response unit 310 for returning a handshake response to information client side 200 from message server 300, to set up a permanently effective link; Described logging request unit 220 for sending user's logging request to message server 300 from information client side 200, and contains Token token in login request message; Described user authentication unit 320 receives described login request message for making message server 300, and carries out user rs authentication; Described communication sets up unit 330 for when determining described user for validated user, message server 300 preserves the connection status of described user, return the user ID ID of described user to described information client side 200, to allow to carry out communication between described information client side 200 and described message server 300 simultaneously.
Above-mentioned handshake request unit 210, logging request unit 220 can be arranged in information client side 200, and above-mentioned handshake response unit 310, user authentication unit 320, communication are set up unit 330 and can be arranged in message server 300.The respective port arranging information client side 200 and message server 300 is open mode, and when there is physical link disconnection between information client side 200 and message server 300, described information client side 200 automatically can initiatively connect described message server 300, thus ensure that signaling link is between the two communicated with, and then can make to carry out real-time working between message server 300 and multiple information client side 200, link 100% reliable, and communication time delay is between the two less.That is, prior art adopts short link mode, namely after link request, within a short period of time just closes, with Deterministic service device without performance bottleneck problem, but produce loss when adopting short link mode, message could can only send in connection situation, and when occurring that physical link disconnects (timeout), other modes are needed to compensate, whole execution mode more complicated.And the application sets up long link (namely link is opened for a long time) by Transmission Control Protocol, and then can real-time listening information client side 200 and the state both message server 300.Because the TCP standard that is established as of initial physical link connects (three-way handshake agreement), thus ensure that the message transmitted between information client side 200 and message server 300 is reliable and complete.Information client side 200 sends user's logging request to message server 300.Described message server 300 by the token token passing in login request message in login authentication server, to carry out inquiring and authenticating.Be disabled user when determining user, then return an authentication failed message to described information client side 200, force the long link of closing the border between described information client side 200 and described message server 300 simultaneously, and play except this disabled user.When determining described user for validated user, preserving the connection status of user, and this connection status being sent to message router, to register the User Status of this validated user; And described message server 300 returns one and contains the message of user ID ID to described information client side 200, to allow to carry out carrying out communication between described information client side 200 and described message server 300.Described information client side 200 keeps in described user ID ID, carries this user ID ID during in order to carry out interacting message.
In an alternative embodiment of the invention, described system can comprise further: message uploading unit 230, local client search unit 340, message this locality issues unit 350, shown in Figure 3.Wherein, described message uploading unit 230 is arranged in information client side 200.Described local client searches unit 340, message this locality issues unit 350 and is arranged in message server 300.
The message that described message uploading unit 230 inputs for making described information client side 200 receive user, and described message is sent to the message server 300 be connected with described information client side 200; Described local client is searched unit 340 and is searched in the local message client 200 be connected with described message server 300 according to the receiving terminal ID in described message for described message server 300; Described message this locality issues unit 350 for when described message server 300 finds corresponding local message client 200 according to the receiving terminal ID in described message, and described message is sent to corresponding local message client 200 by described message server 300.
In an alternative embodiment of the invention, described system can comprise further: message transfer unit 360, route point to unit 410, message strange land issues unit 370, shown in Figure 4.Wherein, described message transfer unit 360, message strange land issue unit 370 and are arranged in message server 300.Described route is pointed to unit 410 and is arranged in message router 400.
Described message transfer unit 360 is not for when described message server 300 finds corresponding local message client 200 according to the receiving terminal ID in described message, and described message server 300 goes to message router 400 by described message; Described route points to unit 410, for making described message router 400 according to the receiving terminal ID in described message by described Message routing extremely corresponding strange land message server 300; Described message strange land issues unit 370 and searches corresponding strange land information client side 200 for described strange land message server 300 according to the receiving terminal ID in described message, and described message is sent to corresponding strange land information client side 200.
100,000 users (preferential 5 ~ 8 general-purpose families) can be carried due to general message service device 300 and consider that number of users can increase gradually, therefore, by distributed arrangement, message server 300 is installed the equipment (i.e. message router 400) with routing function.Described message server 300 carries out long link with message router 400 and is connected, between each message router 400 and message server 300 by unique identification to distinguish message server 300 and message router 400.This unique identification can for distributed number section.That is, the interactive mode between described message router 400 and described message server 300 is synchronous to carry out interacting message by a number section matching method (or claiming geographical cover).The grade of multiple message router 400 is sane levels, but not the superior and the subordinate.In the present embodiment, described message router 400 and described message server 300 can be all distributed deployments.The routing rule of described message router 400 can be similar with the routing rule of physical router.Each message router 400 can corresponding multiple message server 300.Equally, each message server 300 also can corresponding multiple message router 400.Described message server 300 type comprises the message server 300 of tcpsocket interface and the message server 300 (this message server 300 adopts html5 agreement, can be mutual with browser) of websocket interface.Described message server 300 loads on the enterprising news that work of described message router 400, such as web page user can carry out communication with other users of message server 300 rear end (PC holds), and by message router 400 to realize the object of transfer message.Described message server 300 judges that receiving terminal ID in received described message and current message service device 300 identify inconsistent, namely show that receiving terminal is not home messaging server 300, so described message is uploaded to described message router 400 by described message server 300, described router by built-in routing table and receiving terminal ID to determine described message to be issued to corresponding strange land message server 300, this corresponding strange land message server 300 after receiving the message, search corresponding strange land information client side 200, and push described message to corresponding strange land information client side 200.
In an alternative embodiment of the invention, described route is pointed to unit 410 and is comprised further: deferred information preservation module 411, deferred information sending module 510, shown in Figure 5.Wherein, described deferred information is preserved module 411 and is arranged in the route sensing unit 410 of message router 400, and described deferred information sending module 510 is arranged in offline service device 500.
Described deferred information preserve module 411 for when described message router 400 by described Message routing extremely corresponding strange land message server 300 time, find that corresponding strange land information client side 200 is in off-line state, then described message is sent to offline service device 500 to preserve; When described deferred information sending module 510 is in line states for determining described strange land information client side 200 when described offline service device 500, then preserved described message is sent to described strange land message server 300 by described offline service device 500, and is forwarded to corresponding strange land information client side 200.That is, time when user's off-line of receiving terminal or not on current strange land message server 300, described message is considered as deferred information by described message router 400, and by described message stores in offline service device 500.When the user of receiving terminal is again online, except again setting up except physical link, the deferred information sent to online other users of period from off-line will be received, thus ensure the reliable, complete of message.
In an alternative embodiment of the invention, described message this locality issues unit 350 and comprises further: access times computing module 351 and limiting access notification module 352, shown in Figure 6.Wherein, message this locality that described access times computing module 351 and described limiting access notification module 352 are arranged at described message server 300 issues in unit 350.
Specifically, described access times computing module 351 calculates the access times of described information client side 200 within the very first time of presetting for described message server 300.Described limiting access notification module 352 for when described information client side 200 preset the very first time in access times more than a predetermined threshold value time, then described message server 300 sends a limiting access message to described information client side 200, and stops sending described message to receiving terminal.
In an alternative embodiment of the invention, described system can comprise further: exit session request unit 240 and exit conversational response unit 3100, shown in Figure 7.Wherein, exit session request unit 240 described in be arranged in information client side 200.The described conversational response unit 3100 that exits is arranged in message server 300.
The described session request unit 240 that exits exits session request to described message server 300 for making described information client side 200 send one.The described conversational response unit 3100 that exits removes the User Status of respective user for making described message server 300, and sends one and exit conversational response to described information client side 200, wherein saidly exits in conversational response containing exiting mark; The synchronization routing device request that simultaneously sends to message router, to delete the User Status of respective user.
In an alternative embodiment of the invention, described system can comprise further: heartbeat request unit 250, link switching units 3110 and link re-establishment unit 260, shown in Figure 8.Wherein, described heartbeat request unit 250 and described link re-establishment unit 260 are arranged in information client side 200.Described link switching units 3110 is arranged in message server 300.
Described heartbeat request unit 250, sends heartbeat request to described message server 300, to show that described information client side 200 is in state of activation for described information client side 200 at interval of the second time.When described link switching units 3110 does not receive heartbeat request for described message server 300 within the second time, then be considered as described information client side 200 and be in off-line state, force to disconnect the permanently effective link between described information client side 200 simultaneously.When described link re-establishment unit 260 is off for the permanently effective link finding when described information client side 200 between described message server 300, resend the handshake request of Transmission Control Protocol to described message server 300, to re-establish permanently effective link.Like this, the permanently effective of the physical link between information client side 200 and message server 300 can be ensured, and be in stable state.
In an alternative embodiment of the invention, described system can comprise further: client message transmitting element 270, client message comparing unit 280, client message retransmission unit 290, server message transmitting element 3120, server message comparing unit 3130 and server message retransmission unit 3140, shown in Figure 9.Wherein, described client message transmitting element 270, described client message comparing unit 280 and described client message retransmission unit 290 are arranged in described information client side 200.Described server message transmitting element 3120, described server message comparing unit 3130 and described server message retransmission unit 3140 are arranged in message server 300.
Described client message transmitting element 270 is for after sending at least one message when described information client side 200 and after the 3rd time of presetting, described information client side 200 sends a message sink and confirms that request is to described message server 300.For described information client side 200, a message vector corresponding with the last item message received by described message server 300 that described client message comparing unit 280 receives that described message server 300 returns, and the message vector corresponding with the last item message that the described information client side 200 stored sends compares.Described client message retransmission unit 290 is not for receiving part messages when described information client side 200 determines described message server 300, then described information client side 200 resends described part messages.Described server message transmitting element 3120 is for after sending at least one message when described message server 300 and after the 4th time of presetting, described message server 300 sends a message sink and confirms that request is to described information client side 200.For described message server 300, a message vector corresponding with the last item message received by described information client side 200 that described server message comparing unit 3130 receives that described information client side 200 returns, and the message vector corresponding with the last item message that the described message server 300 stored sends compares.Described server message retransmission unit 3140 is not for receiving part messages when described message server 300 determines described information client side 200, then described message server 300 resends described part messages.
Specifically, whether normally receive and dispatch in order to ensure message, do not consider system level under normal circumstances, only consider application, when transmitting terminal sends a request to receiving terminal each time, receipt is to described transmitting terminal in the response lag preset for described receiving terminal, and to show whether receiving terminal receives message, wherein said response lag can define in the communication format of described message.In embodiments of the invention, during when physical link shake, chain rupture or at Internet Transmission, message data may be lost, so adopt based on the compensation mechanism of Transmission Control Protocol, to ensure the stability of message data.As said units, described message server 300 can preserve the message vector that described information client side 200 sends at every turn, and equally, described information client side 200 preserves the message vector that described message server 300 sends at every turn too.When automatically reconnecting after long link disconnects, namely after successful handshake both described information client side 200 and described message server 300, both can compare message vector, if when finding that there is information drop-out, the part messages then the other side do not received is reissued again to the other side, thus ensure that both described information client side 200 and described message server 300 data on physical link are complete, and do not lose.
Obviously, those skilled in the art should be understood that, each module of the invention described above embodiment or each step can realize with general computer installation, they can concentrate on single computer installation, or be distributed on network that multiple computer installation is combined into, alternatively, they can realize with the executable software kit source code of computer installation, thus, they can be stored and be performed by computer installation in the storage device, and in some cases, step shown or described by can performing with the order be different from herein, or they are made each integrated circuit modules respectively, or the multiple module in them or step are made into single integrated circuit module to realize.Like this, the embodiment of the present invention is not limited to any specific hardware and software combination.
The above is only the preferred embodiment of the present invention; it should be pointed out that for those skilled in the art, under the premise without departing from the principles of the invention; can also make some improvements and modifications, these improvements and modifications also should be considered as protection scope of the present invention.
Claims (16)
1. a method for message interaction, is characterized in that, comprising:
(1) information client side sends the handshake request of Transmission Control Protocol to message server;
(2) message server returns a handshake response to information client side, to set up a permanently effective link;
(3) information client side sends user's logging request to message server, and containing Token token in login request message;
(4) message server receives described login request message, and carries out user rs authentication;
(5) when determining described user for validated user, message server preserves the connection status of described user, return the user ID ID of described user to described information client side, to allow to carry out communication between described information client side and described message server simultaneously.
2. method for message interaction according to claim 1, is characterized in that, comprises further after step (5):
(61) described information client side receives the message that user inputs, and described message is sent to the message server be connected with described information client side;
(62) described message server is searched in the local message client be connected with described message server according to the receiving terminal ID in described message;
(63) when described message server finds corresponding local message client according to the receiving terminal ID in described message, described message is sent to corresponding local message client by described message server.
3. method for message interaction according to claim 2, is characterized in that, after step (62), comprises further:
(64) when described message server does not find corresponding local message client according to the receiving terminal ID in described message, described message server goes to message router by described message;
(65) described message router according to the receiving terminal ID in described message by described Message routing to corresponding strange land message server;
(66) described strange land message server searches corresponding strange land information client side according to the receiving terminal ID in described message, and described message is sent to corresponding strange land information client side.
4. method for message interaction according to claim 3, is characterized in that, among step (65), comprises further:
(651) when described message router by described Message routing to corresponding strange land message server time, find that corresponding strange land information client side is in off-line state, then described message be sent to offline service device to preserve;
(652) when described offline service device determine described strange land information client side be in line states time, then preserved described message is sent to described strange land message server by described offline service device, and is forwarded to corresponding strange land information client side.
5. method for message interaction according to claim 2, is characterized in that, comprises further in step (63):
(631) described message server calculates the access times of described information client side within the very first time of presetting;
(632) when the access times of described information client side within the very first time of presetting are more than a predetermined threshold value, then described message server sends a limiting access message to described information client side, and stops sending described message to receiving terminal.
6. method for message interaction according to claim 1, is characterized in that, after step (5), comprises further:
(71) described information client side sends one and exits session request to described message server;
(72) described message server removes the User Status of respective user, and sends one and exit conversational response to described information client side, wherein saidly exits in conversational response containing exiting mark; The synchronization routing device request that simultaneously sends to message router, to delete the User Status of respective user.
7. method for message interaction according to claim 1, is characterized in that, in step (2) and step (3), comprises further:
(81) described information client side sends heartbeat request to described message server, to show that described information client side is in state of activation at interval of the second time;
(82) when described message server does not receive heartbeat request within the second time, be then considered as described information client side and be in off-line state, force to disconnect the permanently effective link between described information client side simultaneously;
(83) when described information client side discovery is off with the permanently effective link between described message server, the handshake request of Transmission Control Protocol is resend to described message server, to re-establish permanently effective link.
8. method for message interaction according to claim 1, is characterized in that, after step (5), comprises further:
(91) after described information client side sends at least one message and after the 3rd time of presetting, described information client side sends a message sink and confirms that request is to described message server;
(92) the described information client side message vector corresponding with the last item message received by described message server that receive that described message server returns, and the message vector corresponding with the last item message that the described information client side stored sends compares;
(93) do not receive part messages when described information client side determines described message server, then described information client side resends described part messages;
(94) after described message server sends at least one message and after the 4th time of presetting, described message server sends a message sink and confirms that request is to described information client side;
(95) the described message server message vector corresponding with the last item message received by described information client side that receive that described information client side returns, and the message vector corresponding with the last item message that the described message server stored sends compares;
(96) do not receive part messages when described message server determines described information client side, then described message server resends described part messages.
9. a message exchange system, is characterized in that, comprising:
Handshake request unit, for sending the handshake request of Transmission Control Protocol to message server from information client side;
Handshake response unit, for returning a handshake response from message server to information client side, to set up a permanently effective link;
Logging request unit, for sending user's logging request to message server from information client side, and containing Token token in login request message;
User authentication unit, for making message server receive described login request message, and carries out user rs authentication;
Unit is set up in communication, for when determining described user for validated user, message server preserves the connection status of described user, returns the user ID ID of described user to described information client side, to allow to carry out communication between described information client side and described message server simultaneously.
10. message exchange system according to claim 9, is characterized in that, described system comprises further:
Message uploading unit, for the message making described information client side reception user input, and is sent to the message server be connected with described information client side by described message;
Local client searches unit, searches according to the receiving terminal ID in described message for described message server in the local message client be connected with described message server;
Message this locality issues unit, and for when described message server finds corresponding local message client according to the receiving terminal ID in described message, described message is sent to corresponding local message client by described message server.
11. message exchange system according to claim 10, is characterized in that, described system comprises further:
Message transfer unit, for when described message server does not find corresponding local message client according to the receiving terminal ID in described message, described message server goes to message router by described message;
Route points to unit, for making described message router according to the receiving terminal ID in described message by described Message routing extremely corresponding strange land message server;
Message strange land issues unit, searches corresponding strange land information client side for described strange land message server according to the receiving terminal ID in described message, and described message is sent to corresponding strange land information client side.
12. message exchange system according to claim 11, it is characterized in that, described route is pointed to unit and is comprised further: deferred information preserves module, for when described message router by described Message routing to corresponding strange land message server time, find that corresponding strange land information client side is in off-line state, then described message is sent to offline service device to preserve;
Deferred information sending module, for determine when described offline service device described strange land information client side be in line states time, then preserved described message is sent to described strange land message server by described offline service device, and is forwarded to corresponding strange land information client side.
13. message exchange system according to claim 10, is characterized in that, described message this locality issues unit and comprises further:
Access times computing module, calculates the access times of described information client side within the very first time of presetting for described message server;
Limiting access notification module, for when described information client side preset the very first time in access times more than a predetermined threshold value time, then described message server sends a limiting access message to described information client side, and stops sending described message to receiving terminal.
14. message exchange system according to claim 9, is characterized in that, described system comprises further:
Exit session request unit, send one for making described information client side and exit session request to described message server;
Exiting conversational response unit, for making described message server remove the User Status of respective user, and send one and exit conversational response to described information client side, wherein saidly to exit in conversational response containing exiting mark; The synchronization routing device request that simultaneously sends to message router, to delete the User Status of respective user.
15. message exchange system according to claim 9, is characterized in that, described system comprises further:
Heartbeat request unit, sends heartbeat request to described message server, to show that described information client side is in state of activation for described information client side at interval of the second time;
Link switching units, when not receiving heartbeat request for described message server within the second time, is then considered as described information client side and is in off-line state, forces to disconnect the permanently effective link between described information client side simultaneously;
Link re-establishment unit, for when described information client side discovery is off with the permanently effective link between described message server, resends the handshake request of Transmission Control Protocol to described message server, to re-establish permanently effective link.
16. message exchange system according to claim 9, is characterized in that, described system comprises further:
Client message transmitting element, for after sending at least one message when described information client side and after the 3rd time of presetting, described information client side sends a message sink and confirms that request is to described message server;
Client message comparing unit, for the message vector corresponding with the last item message received by described message server that described information client side receives that described message server returns, and the message vector corresponding with the last item message that the described information client side stored sends compares;
Client message retransmission unit, for not receiving part messages when described information client side determines described message server, then described information client side resends described part messages;
Server message transmitting element, for after sending at least one message when described message server and after the 4th time of presetting, described message server sends a message sink and confirms that request is to described information client side;
Server message comparing unit, for the message vector corresponding with the last item message received by described information client side that described message server receives that described information client side returns, and the message vector corresponding with the last item message that the described message server stored sends compares;
Server message retransmission unit, for not receiving part messages when described message server determines described information client side, then described message server resends described part messages.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510705356.XA CN105337973B (en) | 2015-10-27 | 2015-10-27 | Method for message interaction and its system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510705356.XA CN105337973B (en) | 2015-10-27 | 2015-10-27 | Method for message interaction and its system |
Publications (2)
Publication Number | Publication Date |
---|---|
CN105337973A true CN105337973A (en) | 2016-02-17 |
CN105337973B CN105337973B (en) | 2019-07-09 |
Family
ID=55288256
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201510705356.XA Active CN105337973B (en) | 2015-10-27 | 2015-10-27 | Method for message interaction and its system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN105337973B (en) |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107172275A (en) * | 2017-04-28 | 2017-09-15 | 太仓鸿策腾达网络科技有限公司 | A kind of information interacting method for mobile terminal |
CN108230654A (en) * | 2018-01-18 | 2018-06-29 | 华立科技股份有限公司 | ammeter data transmission method and device |
CN108989438A (en) * | 2018-07-26 | 2018-12-11 | 青柠智云(杭州)科技有限责任公司 | Implementation method, the device and system of data distribution network |
CN109302496A (en) * | 2018-11-28 | 2019-02-01 | 南昌百恒信息技术有限公司 | A kind of novel real time information stream exchange method |
CN113568936A (en) * | 2021-07-30 | 2021-10-29 | 多点生活(成都)科技有限公司 | Real-time streaming data storage method and device and terminal equipment |
CN113596147A (en) * | 2021-07-27 | 2021-11-02 | 奇安信科技集团股份有限公司 | Message pushing method, device, equipment and storage medium |
CN115623079A (en) * | 2022-12-19 | 2023-01-17 | 中科政汇(北京)科技有限公司 | Data access processing method |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102143091A (en) * | 2010-08-06 | 2011-08-03 | 华为技术有限公司 | Cross-domain operation realization method, system, server and browser |
US20130117382A1 (en) * | 2011-11-07 | 2013-05-09 | Cellco Partnership D/B/A Verizon Wireless | Push messaging platform with high scalability and high availability |
CN103546584A (en) * | 2013-11-13 | 2014-01-29 | 深圳市中兴移动通信有限公司 | Information pushing method and system |
CN104717133A (en) * | 2015-03-16 | 2015-06-17 | 墨仕(厦门)电子商务有限公司 | Distributed message push system and method |
CN104980898A (en) * | 2014-04-04 | 2015-10-14 | 中兴通讯股份有限公司 | Information pushing method, system and equipment |
-
2015
- 2015-10-27 CN CN201510705356.XA patent/CN105337973B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102143091A (en) * | 2010-08-06 | 2011-08-03 | 华为技术有限公司 | Cross-domain operation realization method, system, server and browser |
US20130117382A1 (en) * | 2011-11-07 | 2013-05-09 | Cellco Partnership D/B/A Verizon Wireless | Push messaging platform with high scalability and high availability |
CN103546584A (en) * | 2013-11-13 | 2014-01-29 | 深圳市中兴移动通信有限公司 | Information pushing method and system |
CN104980898A (en) * | 2014-04-04 | 2015-10-14 | 中兴通讯股份有限公司 | Information pushing method, system and equipment |
CN104717133A (en) * | 2015-03-16 | 2015-06-17 | 墨仕(厦门)电子商务有限公司 | Distributed message push system and method |
Cited By (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107172275A (en) * | 2017-04-28 | 2017-09-15 | 太仓鸿策腾达网络科技有限公司 | A kind of information interacting method for mobile terminal |
CN108230654A (en) * | 2018-01-18 | 2018-06-29 | 华立科技股份有限公司 | ammeter data transmission method and device |
CN108989438A (en) * | 2018-07-26 | 2018-12-11 | 青柠智云(杭州)科技有限责任公司 | Implementation method, the device and system of data distribution network |
CN109302496A (en) * | 2018-11-28 | 2019-02-01 | 南昌百恒信息技术有限公司 | A kind of novel real time information stream exchange method |
CN113596147A (en) * | 2021-07-27 | 2021-11-02 | 奇安信科技集团股份有限公司 | Message pushing method, device, equipment and storage medium |
CN113596147B (en) * | 2021-07-27 | 2023-10-24 | 奇安信科技集团股份有限公司 | Message pushing method, device, equipment and storage medium |
CN113568936A (en) * | 2021-07-30 | 2021-10-29 | 多点生活(成都)科技有限公司 | Real-time streaming data storage method and device and terminal equipment |
CN113568936B (en) * | 2021-07-30 | 2023-06-13 | 多点生活(成都)科技有限公司 | Real-time stream data storage method, device and terminal equipment |
CN115623079A (en) * | 2022-12-19 | 2023-01-17 | 中科政汇(北京)科技有限公司 | Data access processing method |
Also Published As
Publication number | Publication date |
---|---|
CN105337973B (en) | 2019-07-09 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105337973A (en) | Message exchange method and system | |
EP2448206B1 (en) | Method, system and device for transmitting video data | |
CN103916311B (en) | A kind of information transmission and control method, Apparatus and system | |
US7814167B2 (en) | System and method for obtaining remote instant messages | |
US10110538B2 (en) | Method and apparatus for message transmission | |
CN105516080B (en) | The processing method of TCP connection, apparatus and system | |
CN105991412B (en) | Information push method and device | |
CN104158883A (en) | Method, device, equipment and system for carrying out user login through cross-terminal equipment | |
US8099510B2 (en) | Relay device and program product, allowing continued communication via an alternative protocol | |
CN105610888A (en) | Method of using socket to push message based on Android and system thereof | |
CN101146051A (en) | An enterprise-level instant communication interconnection system and method for realizing enterprise interconnection | |
US20120297031A1 (en) | Anonymous Signalling | |
CN102769582B (en) | Logical server, instant messaging system and instant messaging method | |
CN106452973A (en) | A method, apparatus and terminal maintaining persistent connection of communication links | |
CN103685570A (en) | Server, terminal and message pushing method | |
CN105978796A (en) | Message communication method and system based on unstable mobile network | |
CN105323537A (en) | Video conferencing with mobile platform | |
US8239548B2 (en) | Endpoint discriminator in network transport protocol startup packets | |
US9866644B2 (en) | Terminal, message distribution system, message distribution method, and computer-readable medium | |
CN105933217B (en) | Message synchronization method and platform, network server and adaptive server | |
CN108632355B (en) | Routing method for household appliance network, control terminal, readable storage medium and equipment | |
CN105991629B (en) | TCP connection method for building up and device | |
CN103001984A (en) | Method and system for off-line management of mobile social network | |
CN110661697B (en) | Message synchronization method, device, readable storage medium, electronic device and system | |
KR102412225B1 (en) | Message server and message processing apparatus including the same |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
CB02 | Change of applicant information |
Address after: 201815 Shanghai Industrial Zone, Jiading Huiyuan Road, No. 6, building 2, room E, room, 208 Applicant after: Shanghai looking for steel network information Polytron Technologies Inc Address before: 201815 Shanghai, Jiading Industrial Zone, Huiyuan Road, No. F, building, room 2, floor E, room 208 Applicant before: Shanghai steel electron rich commercial affairs company limited |
|
COR | Change of bibliographic data | ||
GR01 | Patent grant | ||
GR01 | Patent grant |