CN107145535A - Instant communicating method and device and server - Google Patents

Instant communicating method and device and server Download PDF

Info

Publication number
CN107145535A
CN107145535A CN201710256096.1A CN201710256096A CN107145535A CN 107145535 A CN107145535 A CN 107145535A CN 201710256096 A CN201710256096 A CN 201710256096A CN 107145535 A CN107145535 A CN 107145535A
Authority
CN
China
Prior art keywords
terminal
information
transmitting terminal
message content
receiving terminal
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
CN201710256096.1A
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.)
CHANJET INFORMATION TECHNOLOGY Co Ltd
Original Assignee
CHANJET INFORMATION TECHNOLOGY 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 CHANJET INFORMATION TECHNOLOGY Co Ltd filed Critical CHANJET INFORMATION TECHNOLOGY Co Ltd
Priority to CN201710256096.1A priority Critical patent/CN107145535A/en
Publication of CN107145535A publication Critical patent/CN107145535A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2453Query optimisation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases
    • G06F16/215Improving data quality; Data cleansing, e.g. de-duplication, removing invalid entries or correcting typographical errors
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L51/00User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
    • H04L51/04Real-time or near real-time messaging, e.g. instant messaging [IM]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L51/00User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
    • H04L51/06Message adaptation to terminal or network requirements
    • H04L51/066Format adaptation, e.g. format conversion or compression

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Signal Processing (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Quality & Reliability (AREA)
  • Computational Linguistics (AREA)
  • Mobile Radio Communication Systems (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention provides a kind of instant communicating method and device and server.Wherein, a kind of instant communicating method, for server, instant communicating method includes:Set up and be connected with transmitting terminal using non-block type IO threads;Receive and preserve the information and link information of transmitting terminal;Receiving terminal is confirmed according to information, and message content is sent to receiving terminal.By technical scheme, system resource is greatlyd save, increases the arrival rate and reliability of message, and realizes mobile terminal and Web terminal message intercommunications, so as to meet the demand of collaborative work, office efficiency and management means is lifted.

Description

Instant communicating method and device and server
Technical field
The present invention relates to communication technical field, in particular to a kind of instant communicating method and device, one kind is further related to Server.
Background technology
In the current mobile Internet epoch, smart mobile phone popularity rate is lifted increasingly, and the life of people is altered in steps, but Mobile phone, there is also certain defect, especially carrier are smaller, are not easy to user and input a large amount of words as input equipment.It is common Instant messaging product, mostly only provides mobile end system, and user can only use in mobile terminal.For synergetic office work, due to its use Family colony is mostly active user, and it is using user's accounting at mobile terminal and PC ends all than larger, and this is single for a mobile terminal Mode, contradiction is highlighted increasingly, no longer meets use demand.
Therefore, how a kind of instant messaging product is provided, facilitates user to input and disclosure satisfy that mobile terminal and Web ends message Intercommunication, as current urgent problem to be solved.
The content of the invention
It is contemplated that at least solving one of technical problem present in prior art or correlation technique.
Therefore, it is an object of the present invention to propose a kind of instant communicating method.
It is another object of the present invention to propose a kind of immediate communication device.
A further object of the present invention is to propose a kind of server.
In view of this, the present invention proposes a kind of instant communicating method, and for server, instant communicating method includes:Adopt Set up and be connected with transmitting terminal with non-block type IO threads;Receive and preserve the information and link information of transmitting terminal;According to disappearing Validation of information receiving terminal is ceased, and message content is sent to receiving terminal.
According to the instant communicating method of the present invention, because every server needs to receive user's connection of magnanimity, simultaneously meeting There is larger concurrent request, set up and be connected with transmitting terminal by using non-block type IO threads, it is only necessary to which a thread can connect By the connection of all passages, and corresponding business processing is each connected, performed by follow-up processing thread;Each transmitting terminal connection After logining successfully, the information and link information of transmitting terminal are preserved by server;Receiving terminal is confirmed according to information, will be disappeared Content push is ceased to receiving terminal.By technical scheme, greatly save system resource, increase message arrival rate and Reliability, and realize mobile terminal and Web terminal message intercommunications, so as to meet the demand of collaborative work, lifting office efficiency and Management means.
In addition, according to the above-mentioned instant communicating method of the present invention, can also have technical characteristic additional as follows:
In the above-mentioned technical solutions, it is preferable that preserve the information and link information of transmitting terminal, specifically include:It will disappear Breath information is preserved into cache database;Judge the type of transmitting terminal, believed according to the connection that the type of transmitting terminal preserves transmitting terminal Breath;When transmitting terminal is mobile terminal, the link information of mobile terminal is preserved into the first internal memory;When transmitting terminal is Web terminals When, the link information at Web ends is preserved into the second internal memory.
, can be according to actual conditions to slow by the way that information is preserved into cache database in the technical scheme Information in depositing carries out periodic cleaning, further saves system resource, mitigates the operation burden of system;By by mobile terminal Link information preserve into the first internal memory, the link information at Web ends is preserved into the second internal memory, pushed by message content During to receiving terminal, the seeking scope of receiving terminal address information is reduced, so that efficiently, efficiently PUSH message content is to receiving terminal, Increase the arrival rate and reliability of message.
In the above-mentioned technical solutions, it is preferable that receiving terminal is confirmed according to information, and message content is sent to reception End, is specifically included:Judge transmitting terminal type and receiving terminal type it is whether consistent;When judged result is to be, it will directly disappear Breath content is sent to receiving terminal;When judged result is no, message content is entered into row format conversion, and by the message after conversion Hold and send to receiving terminal.
In the technical scheme, by judging whether the type of transmitting terminal and receiving terminal is consistent, when judged result is consistent, Illustrate to be accomplished that mobile terminal and mobile terminal or Web ends and the direct single communication in Web ends, now directly send message content To receiving terminal, without carrying out stylistic conversion to message content;When judged result is inconsistent, illustrate to be accomplished that movement Message intercommunication between end and Web ends, now needs the message content for sending transmitting terminal to enter row format conversion, to adapt to receive The content format agreement at end.So as to realize the message of mobile terminal push, the message at Web ends push and mobile terminal and Web ends between Message intercommunication.
In the above-mentioned technical solutions, it is preferable that message content is entered into row format conversion, specifically included:By json agreements with Self-defined binary protocol is mutually changed.
In the technical scheme, the self-defined binary protocol of message content that mobile terminal is pushed, due to it is traditional i.e. When communication system mostly use XMPP, the agreement is XML structure, and its content mostly passes through node description information, overall association View 60% is void content, is caused under mobile internet environment, compares the electricity and flow of consumption user, and self-defined binary system Agreement, because protocol contents are smaller, and length is fixed, and is reduced the redundancy of data, transmission rate and is improved, corresponding peace Full property is also strengthened;The agreement that Web ends use for the browser of compatible different vendor, the message content pushed simultaneously It is json forms, consequently facilitating the parsing and extension of visit device;By by Web ends using json protocol definitions message content with The message content that mobile terminal is defined using self-defined binary protocol is mutually changed, so as to complete the instant of mobile terminal and web terminal Communication.
In the above-mentioned technical solutions, it is preferable that link information includes following at least any one or its combination:Transmitting terminal IP, port information;Information includes following at least any one or its combination:The IP of message content, receiving terminal.
In the technical scheme, the IP of receiving terminal is got from corresponding caching according to information, in corresponding Port information corresponding with the IP, and then the push of completion message content are found in depositing.It should be appreciated by those skilled in the art that Transmitting terminal and receiving terminal are all client, and transmitting terminal and receiving terminal are relative;In addition, IP of the link information including transmitting terminal, Port information, but not limited to this;Information includes message content, the IP of receiving terminal, but not limited to this.
The present invention also proposes a kind of immediate communication device, and for server, immediate communication device includes:Connection unit, is used It is connected in being set up using non-block type IO threads with transmitting terminal;Memory cell, the information for receiving and preserving transmitting terminal And link information;Transmitting element, for confirming receiving terminal according to information, and message content is sent to receiving terminal.
According to the immediate communication device of the present invention, because every server needs to receive user's connection of magnanimity, simultaneously meeting There is larger concurrent request, set up and be connected with transmitting terminal by using non-block type IO threads, it is only necessary to which a thread can connect By the connection of all passages, and corresponding business processing is each connected, performed by follow-up processing thread;Each transmitting terminal connection After logining successfully, the information and link information of transmitting terminal are preserved by server;Receiving terminal is confirmed according to information, will be disappeared Content push is ceased to receiving terminal.By technical scheme, greatly save system resource, increase message arrival rate and Reliability, and realize mobile terminal and Web terminal message intercommunications, so as to meet the demand of collaborative work, lifting office efficiency and Management means.
In addition, according to the above-mentioned immediate communication device of the present invention, can also have technical characteristic additional as follows:
In the above-mentioned technical solutions, it is preferable that memory cell, specifically include:Buffer unit, for information to be preserved Into cache database;First judging unit, the type for judging transmitting terminal preserves transmitting terminal according to the type of transmitting terminal Link information;Internal storage location, for when transmitting terminal is mobile terminal, the link information of mobile terminal to be preserved to the first internal memory In;When transmitting terminal is Web terminals, the link information at Web ends is preserved into the second internal memory.
, can be according to actual conditions to slow by the way that information is preserved into cache database in the technical scheme Information in depositing carries out periodic cleaning, further saves system resource, mitigates the operation burden of system;By by mobile terminal Link information preserve into the first internal memory, the link information at Web ends is preserved into the second internal memory, pushed by message content During to receiving terminal, the seeking scope of receiving terminal address information is reduced, so that efficiently, efficiently PUSH message content is to receiving terminal, Increase the arrival rate and reliability of message.
In the above-mentioned technical solutions, it is preferable that transmitting element, specifically include:Second judging unit, for judging transmitting terminal Type and receiving terminal type it is whether consistent;Unit is directly transmitted, during for being when judged result, directly by message content Send to receiving terminal;Format conversion unit, for when judged result is no, message content being entered into row format conversion, and will turn Message content after changing is sent to receiving terminal.
In the technical scheme, by judging whether the type of transmitting terminal and receiving terminal is consistent, when judged result is consistent, Illustrate to be accomplished that mobile terminal and mobile terminal or Web ends and the direct single communication in Web ends, now directly send message content To receiving terminal, without carrying out stylistic conversion to message content;When judged result is inconsistent, illustrate to be accomplished that movement Message intercommunication between end and Web ends, now needs the message content for sending transmitting terminal to enter row format conversion, to adapt to receive The content format agreement at end.So as to realize the message of mobile terminal push, the message at Web ends push and mobile terminal and Web ends between Message intercommunication.
In the above-mentioned technical solutions, it is preferable that format conversion unit, specifically for:Json agreements are entered with self-defined two Agreement processed is mutually changed.
In the technical scheme, the self-defined binary protocol of message content that mobile terminal is pushed, due to it is traditional i.e. When communication system mostly use XMPP, the agreement is XML structure, and its content mostly passes through node description information, overall association View 60% is void content, is caused under mobile internet environment, compares the electricity and flow of consumption user, and self-defined binary system Agreement, because protocol contents are smaller, and length is fixed, and is reduced the redundancy of data, transmission rate and is improved, corresponding peace Full property is also strengthened;The agreement that Web ends use for the browser of compatible different vendor, the message content pushed simultaneously It is json forms, consequently facilitating the parsing and extension of visit device;By by Web ends using json protocol definitions message content with The message content that mobile terminal is defined using self-defined binary protocol is mutually changed, so as to complete the instant of mobile terminal and web terminal Communication.
In the above-mentioned technical solutions, it is preferable that link information includes at least one of following or its combination:The IP of transmitting terminal, Port information;Information includes following at least any one or its combination:The IP of message content, receiving terminal.
In the technical scheme, the IP of receiving terminal is got from corresponding caching according to information, in corresponding Port information corresponding with the IP, and then the push of completion message content are found in depositing.It should be appreciated by those skilled in the art that Transmitting terminal and receiving terminal are all client, and transmitting terminal and receiving terminal are relative;In addition, IP of the link information including transmitting terminal, Port information, but not limited to this;Information includes message content, the IP of receiving terminal, but not limited to this.
The present invention also proposes the immediate communication device in a kind of server, including any of the above-described technical scheme.The server With with the immediate communication device identical technique effect in any of the above-described technical scheme, will not be repeated here.
The additional aspect and advantage of the present invention will become obvious in following description section, or pass through the practice of the present invention Recognize.
Brief description of the drawings
The above-mentioned and/or additional aspect and advantage of the present invention will become from description of the accompanying drawings below to embodiment is combined Substantially and be readily appreciated that, wherein:
Fig. 1 shows the schematic flow sheet of instant communicating method according to an embodiment of the invention;
Fig. 2 shows the schematic flow sheet of instant communicating method according to yet another embodiment of the invention;
Fig. 3 shows the schematic flow sheet of the instant communicating method according to further embodiment of this invention;
Fig. 4 shows the schematic block diagram of immediate communication device according to an embodiment of the invention;
Fig. 5 shows the schematic block diagram of immediate communication device according to yet another embodiment of the invention;
Fig. 6 shows the schematic block diagram of the immediate communication device according to further embodiment of this invention;
Fig. 7 shows the schematic block diagram of server according to an embodiment of the invention;
Fig. 8 shows the schematic diagram of the non-block type IO threads according to a specific embodiment of the invention;
Fig. 9 shows the schematic diagram of the websocket protocol according to a specific embodiment of the invention.
Embodiment
It is below in conjunction with the accompanying drawings and specific real in order to be more clearly understood that the above objects, features and advantages of the present invention Mode is applied the present invention is further described in detail.It should be noted that in the case where not conflicting, the implementation of the application Feature in example and embodiment can be mutually combined.
Many details are elaborated in the following description to facilitate a thorough understanding of the present invention, still, the present invention may be used also Implemented with being different from other modes described here using other, therefore, protection scope of the present invention is not by described below Specific embodiment limitation.
As shown in figure 1, the schematic flow sheet of instant communicating method according to an embodiment of the invention:
Step 102, set up and be connected with transmitting terminal using non-block type IO threads;
Step 104, receive and preserve the information and link information of transmitting terminal;
Step 106, receiving terminal is confirmed according to information, and message content is sent to receiving terminal.
In this embodiment, because every server needs to receive user's connection of magnanimity, while having larger concurrent Request, sets up with transmitting terminal by using non-block type IO threads and is connected, it is only necessary to which a thread is that acceptable all passages connect Connect, and each connect corresponding business processing, performed by follow-up processing thread;After each transmitting terminal connection is logined successfully, The information and link information of transmitting terminal are preserved by server;Receiving terminal is confirmed according to information, message content is pushed To receiving terminal.By technical scheme, system resource is greatlyd save, increases the arrival rate and reliability of message, and Mobile terminal and Web terminal message intercommunications are realized, so that the demand of collaborative work is met, lifting office efficiency and management means.
As shown in Fig. 2 the schematic flow sheet of instant communicating method according to yet another embodiment of the invention:
Step 202, set up and be connected with transmitting terminal using non-block type IO threads;
The information and link information of transmitting terminal are preserved, is specifically included:
Step 204, information is preserved into cache database;
Step 206, judge the type of transmitting terminal, the link information of transmitting terminal is preserved according to the type of transmitting terminal;
Step 208, when transmitting terminal is mobile terminal, the link information of mobile terminal is preserved into the first internal memory;
Step 210, when transmitting terminal is Web terminals, the link information at Web ends is preserved into the second internal memory;
Step 212, receiving terminal is confirmed according to information, and message content is sent to receiving terminal.
In this embodiment, can be according to actual conditions to caching by the way that information is preserved into cache database Interior information carries out periodic cleaning, further saves system resource, mitigates the operation burden of system;By by mobile terminal Link information is preserved into the first internal memory, and the link information at Web ends is preserved into the second internal memory, pushed to by message content During receiving terminal, the seeking scope of receiving terminal address information is reduced, so that efficiently, efficiently PUSH message content, to receiving terminal, increases Plus the arrival rate and reliability of message.
As shown in figure 3, according to the schematic flow sheet of the instant communicating method of further embodiment of this invention:
Step 302, set up and be connected with transmitting terminal using non-block type IO threads;
The information and link information of transmitting terminal are preserved, is specifically included:
Step 304, information is preserved into cache database;
Step 306, judge the type of transmitting terminal, the link information of transmitting terminal is preserved according to the type of transmitting terminal;
Step 308, when transmitting terminal is mobile terminal, the link information of mobile terminal is preserved into the first internal memory;
Step 310, when transmitting terminal is Web terminals, the link information at Web ends is preserved into the second internal memory;
Receiving terminal is confirmed according to information, and message content is sent to receiving terminal, is specifically included:
Step 312, judge transmitting terminal type and receiving terminal type it is whether consistent;
Step 314, when judged result is to be, directly message content is sent to receiving terminal;
Step 316, when judged result for it is no when, message content is entered into row format conversion, and by the message content after conversion Send to receiving terminal.
In this embodiment, by judging whether the type of transmitting terminal and receiving terminal is consistent, when judged result is consistent, say It is bright to be accomplished that mobile terminal and mobile terminal or Web ends and the direct single communication in Web ends, now directly by message content send to Receiving terminal, without carrying out stylistic conversion to message content;When judged result is inconsistent, illustrate to be accomplished that mobile terminal Message intercommunication between Web ends, now needs the message content for sending transmitting terminal to enter row format conversion, to adapt to receiving terminal Content format agreement.So as to realize the message of mobile terminal push, the message at Web ends push and mobile terminal and Web ends between Message intercommunication.
In the above embodiment, it is preferable that message content is entered into row format conversion, specifically include:By json agreements and certainly Binary protocol is defined mutually to change.
In this embodiment, the self-defined binary protocol of mobile terminal is pushed message content, due to traditional instant Communication system mostly uses XMPP, and the agreement is XML structure, and its content mostly passes through node description information, overall agreement 60% is void content, is caused under mobile internet environment, compares the electricity and flow of consumption user, and self-defined binary system is assisted View, because protocol contents are smaller, and length is fixed, and is reduced the redundancy of data, transmission rate and is improved, corresponding safety Property is also strengthened;Web ends are for the browser of compatible different vendor simultaneously, and the agreement that the message content pushed is used is Json forms, consequently facilitating the parsing and extension of visit device;Pass through the message content by Web ends using json protocol definitions and shifting The message content that moved end is defined using self-defined binary protocol is mutually changed, so as to complete the IMU of mobile terminal and web terminal Letter.
In the above embodiment, it is preferable that link information includes at least one of following or its combination:The IP of transmitting terminal, end Message ceases;Information includes following at least any one or its combination:The IP of message content, receiving terminal.
In this embodiment, the IP of receiving terminal is got from corresponding caching according to information, in corresponding internal memory In find port information corresponding with the IP, and then the push of completion message content.It should be appreciated by those skilled in the art that hair Sending end and receiving terminal are all client, and transmitting terminal and receiving terminal are relative;In addition, link information includes the IP of transmitting terminal, end Message ceases, but not limited to this;Information includes message content, the IP of receiving terminal, but not limited to this.
As shown in figure 4, the schematic block diagram of immediate communication device according to an embodiment of the invention:
Connection unit 402, is connected for being set up using non-block type IO threads with transmitting terminal;
Memory cell 404, information and link information for receiving and preserving transmitting terminal;
Transmitting element 406, for confirming receiving terminal according to information, and message content is sent to receiving terminal.
In this embodiment, because every server needs to receive user's connection of magnanimity, while having larger concurrent Request, sets up with transmitting terminal by using non-block type IO threads and is connected, it is only necessary to which a thread is that acceptable all passages connect Connect, and each connect corresponding business processing, performed by follow-up processing thread;After each transmitting terminal connection is logined successfully, The information and link information of transmitting terminal are preserved by server;Receiving terminal is confirmed according to information, message content is pushed To receiving terminal.By technical scheme, system resource is greatlyd save, increases the arrival rate and reliability of message, and Mobile terminal and Web terminal message intercommunications are realized, so that the demand of collaborative work is met, lifting office efficiency and management means.
As shown in figure 5, the schematic block diagram of immediate communication device according to yet another embodiment of the invention:
Connection unit 502, is connected for being set up using non-block type IO threads with transmitting terminal;
Memory cell 504, information and link information for receiving and preserving transmitting terminal;
Transmitting element 506, for confirming receiving terminal according to information, and message content is sent to receiving terminal;
Wherein memory cell 504 is specifically included:
Buffer unit 5042, for information to be preserved into cache database;
First judging unit 5044, the type for judging transmitting terminal preserves the company of transmitting terminal according to the type of transmitting terminal Connect information;
Internal storage location 5046, for when transmitting terminal is mobile terminal, the link information of mobile terminal to be preserved in first In depositing;When transmitting terminal is Web terminals, the link information at Web ends is preserved into the second internal memory.
In this embodiment, can be according to actual conditions to caching by the way that information is preserved into cache database Interior information carries out periodic cleaning, further saves system resource, mitigates the operation burden of system;By by mobile terminal Link information is preserved into the first internal memory, and the link information at Web ends is preserved into the second internal memory, pushed to by message content During receiving terminal, the seeking scope of receiving terminal address information is reduced, so that efficiently, efficiently PUSH message content, to receiving terminal, increases Plus the arrival rate and reliability of message.
As shown in fig. 6, according to the schematic block diagram of the immediate communication device of further embodiment of this invention:
Connection unit 602, is connected for being set up using non-block type IO threads with transmitting terminal;
Memory cell 604, information and link information for receiving and preserving transmitting terminal;
Transmitting element 606, for confirming receiving terminal according to information, and message content is sent to receiving terminal;
Wherein memory cell 604 is specifically included:
Buffer unit 6042, for information to be preserved into cache database;
First judging unit 6044, the type for judging transmitting terminal preserves the company of transmitting terminal according to the type of transmitting terminal Connect information;
Internal storage location 6046, for when transmitting terminal is mobile terminal, the link information of mobile terminal to be preserved in first In depositing;When transmitting terminal is Web terminals, the link information at Web ends is preserved into the second internal memory;
Wherein transmitting element 606 is specifically included:
Second judging unit 6062, for judge transmitting terminal type and receiving terminal type it is whether consistent;
Unit 6064 being directly transmitted, during for being when judged result, directly being sent message content to receiving terminal;
Format conversion unit 6066, for when judged result is no, message content to be entered into row format conversion, and will conversion Message content afterwards is sent to receiving terminal.
In this embodiment, by judging whether the type of transmitting terminal and receiving terminal is consistent, when judged result is consistent, say It is bright to be accomplished that mobile terminal and mobile terminal or Web ends and the direct single communication in Web ends, now directly by message content send to Receiving terminal, without carrying out stylistic conversion to message content;When judged result is inconsistent, illustrate to be accomplished that mobile terminal Message intercommunication between Web ends, now needs the message content for sending transmitting terminal to enter row format conversion, to adapt to receiving terminal Content format agreement.So as to realize the message of mobile terminal push, the message at Web ends push and mobile terminal and Web ends between Message intercommunication.
In the above embodiment, it is preferable that format conversion unit, is specifically included:By json agreements and self-defined binary system Agreement is mutually changed.
In this embodiment, the self-defined binary protocol of mobile terminal is pushed message content, due to traditional instant Communication system mostly uses XMPP, and the agreement is XML structure, and its content mostly passes through node description information, overall agreement 60% is void content, is caused under mobile internet environment, compares the electricity and flow of consumption user, and self-defined binary system is assisted View, because protocol contents are smaller, and length is fixed, and is reduced the redundancy of data, transmission rate and is improved, corresponding safety Property is also strengthened;Web ends are for the browser of compatible different vendor simultaneously, and the agreement that the message content pushed is used is Json forms, consequently facilitating the parsing and extension of visit device;Pass through the message content by Web ends using json protocol definitions and shifting The message content that moved end is defined using self-defined binary protocol is mutually changed, so as to complete the IMU of mobile terminal and web terminal Letter.
In the above embodiment, it is preferable that link information includes at least one of following or its combination:The IP of transmitting terminal, end Message ceases;Information includes following at least any one or its combination:The IP of message content, receiving terminal.
In this embodiment, the IP of receiving terminal is got from corresponding caching according to information, in corresponding internal memory In find port information corresponding with the IP, and then the push of completion message content.It should be appreciated by those skilled in the art that hair Sending end and receiving terminal are all client, and transmitting terminal and receiving terminal are relative;In addition, link information includes the IP of transmitting terminal, end Message ceases, but not limited to this;Information includes message content, the IP of receiving terminal, but not limited to this.
As shown in fig. 7, the schematic block diagram of server according to an embodiment of the invention:Server 700, including it is any of the above-described Immediate communication device 702 in embodiment.The server 700 has and the immediate communication device in any of the above-described technical scheme 702 identical technique effects, will not be repeated here.
Specific embodiment, building ring mobile terminal and Web ends instantaneous communication system, including mobile terminal instantaneous communication system and Web ends instantaneous communication system.
Wherein, mobile terminal instantaneous communication system uses non-block type IO, is with reference to customized binary protocol The framework of system.Designed non-block type IO threading models are as shown in figure 8, using non-block type IO, it is only necessary to a thread Receive all passage connections, and each connect corresponding business processing, performed by follow-up processing thread, the threading model is big System resource is saved greatly.After each client connection is logined successfully, connection status is preserved by server, including client ip and The information such as port.Message between is pushed, the content push between as connecting and connecting.For example, when user A with When sending out message between user B, user A message need to be only sent to server end, as the machine where server finds user B Device, can then find user B actual connection, message content is pushed to user B connection.Self-defining two enter Agreement processed, as shown in table 1:
The self-defined binary protocol of table 1
Wherein, Content is the actual message content pushed, and Length grows for bag, due to being in binary protocol, agreement Appearance is smaller, and length is fixed, and reduces the redundancy of data, transmission rate is improved, corresponding security is also added By force.
The difference of Web ends instantaneous communication system and mobile terminal instantaneous communication system is that Web ends employ websocket Agreement, so that the long connection of the html pages is maintained, as shown in figure 9, websocket protocol is mainly described by the first two byte The situation of packet, highest order is used to describe whether message content terminates, and second byte of message is mainly used in describing mask And message-length.Specifically, FIN:1 is used to describe whether message terminates;Each 1 of RSV1, RSV2, RSV3, it is fixed for extending Justice;OPCODE:4, for representing message sink type, if receiving unknown opcode, receiving terminal must shut off connection; MASK:1, for whether identifying PayloadData by mask processing, the data frame that client is sent needs to carry out at mask Reason, so this position is 1;Byte below is message body.
The connection set up by web page, is stored in server end using single memory object;Disappear to page push Breath, that is to say and connecting object entity is found from internal memory, and message content is pushed into it connects client;For compatible different factories The browser of business, the agreement that the message content pushed is used is json forms, consequently facilitating the parsing and extension of visit device. All connections in mobile terminal, storage object is located at Map<Mobile>In, all connections in Web ends, storage object is located at Map< Web>In, the message intercommunication between two ends, master to do is to the binary protocol of mobile terminal, with the json required for web page The Content Transformation of form, after converting, from corresponding connecting object caching, finds specific connection, message content is pushed To passage, that is, complete the message instant messaging of mobile terminal and web terminal.
In this embodiment, building ring mobile terminal and Web ends instantaneous communication system, handling mobile terminal and Web ends respectively please The business processing work asked.This framework supports 200 people simultaneously online compared with XML schema before by original unit, lifting Support 10,000,000,000 people simultaneously online to unit.Using new binary protocol, message content and XMPP contents phase before Than 6 times or so being substantially reduced, while the arrival rate and reliability of message have obtained larger increase.
In the description of this specification, term " first ", " second " are only used for the purpose of description, and it is not intended that indicating Or imply relative importance.For the ordinary skill in the art, it can understand that above-mentioned term exists as the case may be Concrete meaning in the present invention.
The preferred embodiments of the present invention are the foregoing is only, are not intended to limit the invention, for the skill of this area For art personnel, the present invention can have various modifications and variations.Within the spirit and principles of the invention, that is made any repaiies Change, equivalent substitution, improvement etc., should be included in the scope of the protection.

Claims (11)

1. a kind of instant communicating method, for server, it is characterised in that the instant communicating method includes:
Set up and be connected with transmitting terminal using non-block type IO threads;
Receive and preserve the information and link information of the transmitting terminal;
Receiving terminal is confirmed according to the information, and message content is sent to the receiving terminal.
2. instant communicating method according to claim 1, it is characterised in that the information of the preservation transmitting terminal And link information, specifically include:
The information is preserved into cache database;
Judge the type of the transmitting terminal, the link information of the transmitting terminal is preserved according to the type of the transmitting terminal;
When the transmitting terminal is mobile terminal, the link information of the mobile terminal is preserved into the first internal memory;When the hair When sending end is Web terminals, the link information at the Web ends is preserved into the second internal memory.
3. instant communicating method according to claim 1, it is characterised in that described to be confirmed to receive according to the information End, and message content is sent to the receiving terminal, specifically include:
Judge whether the type of the transmitting terminal is consistent with the type of the receiving terminal;
When judged result is to be, directly the message content is sent to the receiving terminal;
When judged result is no, the message content is entered into row format conversion, and the message content after conversion is sent to institute State receiving terminal.
4. instant communicating method according to claim 3, it is characterised in that described that the message content is entered into row format turn Change, specifically include:Json agreements are mutually changed with self-defined binary protocol.
5. instant communicating method according to any one of claim 1 to 4, it is characterised in that
The link information includes following at least any one or its combination:IP, the port information of the transmitting terminal;The message letter Breath includes following at least any one or its combination:The IP of the message content, the receiving terminal.
6. a kind of immediate communication device, for server, it is characterised in that the immediate communication device includes:
Connection unit, is connected for being set up using non-block type IO threads with transmitting terminal;
Memory cell, information and link information for receiving and preserving the transmitting terminal;
Transmitting element, for confirming receiving terminal according to the information, and message content is sent to the receiving terminal.
7. immediate communication device according to claim 6, it is characterised in that the memory cell, is specifically included:
Buffer unit, for the information to be preserved into cache database;
First judging unit, the type for judging the transmitting terminal preserves the transmitting terminal according to the type of the transmitting terminal Link information;
Internal storage location, for when the transmitting terminal is mobile terminal, the link information of the mobile terminal to be preserved in first In depositing;When the transmitting terminal is Web terminals, the link information at the Web ends is preserved into the second internal memory.
8. immediate communication device according to claim 6, it is characterised in that the transmitting element, is specifically included:
Second judging unit, for judging whether the type of the transmitting terminal is consistent with the type of the receiving terminal;
Unit being directly transmitted, during for being when judged result, directly being sent the message content to the receiving terminal;
Format conversion unit, for when judged result is no, the message content to be entered into row format conversion, and by after conversion Message content is sent to the receiving terminal.
9. immediate communication device according to claim 8, it is characterised in that the format conversion unit, specifically for:Will Json agreements are mutually changed with self-defined binary protocol.
10. the immediate communication device according to any one of claim 6 to 9, it is characterised in that
The link information includes following at least any one or its combination:IP, the port information of the transmitting terminal;The message letter Breath includes following at least any one or its combination:The IP of the message content, the receiving terminal.
11. a kind of server, it is characterised in that including the immediate communication device as any one of claim 6 to 10.
CN201710256096.1A 2017-04-19 2017-04-19 Instant communicating method and device and server Pending CN107145535A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710256096.1A CN107145535A (en) 2017-04-19 2017-04-19 Instant communicating method and device and server

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710256096.1A CN107145535A (en) 2017-04-19 2017-04-19 Instant communicating method and device and server

Publications (1)

Publication Number Publication Date
CN107145535A true CN107145535A (en) 2017-09-08

Family

ID=59774362

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710256096.1A Pending CN107145535A (en) 2017-04-19 2017-04-19 Instant communicating method and device and server

Country Status (1)

Country Link
CN (1) CN107145535A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108123868A (en) * 2017-12-20 2018-06-05 家园网络科技有限公司 Communication system, method, apparatus and service terminal
CN110300135A (en) * 2018-03-22 2019-10-01 北京京东尚科信息技术有限公司 Content of text sending method, device, electronic equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2005043781A1 (en) * 2003-10-28 2005-05-12 Sheng Zhan Information Technology (Shanghai) Ltd. Method and system for connecting characters, words and signs to a telecommunication number
CN102088393A (en) * 2009-12-02 2011-06-08 南京南瑞继保电气有限公司 Method for transmitting positive and negative data across safety zone
CN103312751A (en) * 2012-03-14 2013-09-18 南京新与力文化传播有限公司 Instant messaging method based on browser
CN104125208A (en) * 2013-10-15 2014-10-29 腾讯科技(深圳)有限公司 Data transmission method and data transmission device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2005043781A1 (en) * 2003-10-28 2005-05-12 Sheng Zhan Information Technology (Shanghai) Ltd. Method and system for connecting characters, words and signs to a telecommunication number
CN102088393A (en) * 2009-12-02 2011-06-08 南京南瑞继保电气有限公司 Method for transmitting positive and negative data across safety zone
CN103312751A (en) * 2012-03-14 2013-09-18 南京新与力文化传播有限公司 Instant messaging method based on browser
CN104125208A (en) * 2013-10-15 2014-10-29 腾讯科技(深圳)有限公司 Data transmission method and data transmission device

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108123868A (en) * 2017-12-20 2018-06-05 家园网络科技有限公司 Communication system, method, apparatus and service terminal
CN110300135A (en) * 2018-03-22 2019-10-01 北京京东尚科信息技术有限公司 Content of text sending method, device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN103220292B (en) Cross-safe-area data transmission and system
CN104717647B (en) Professional ability method for authenticating, equipment and system
CN105763619B (en) The method and device that client and server-side are communicated
CN108494817A (en) Data transmission method, relevant apparatus and system
CN102567125A (en) Method for realizing communication between browser pages
CN104486327B (en) Communication means and client between the page and long connection server
CN102707696B (en) Multi-serial-port data transmission method and transmission center system
CN102202010A (en) Message transmission client and communication method with combination of short message and network
US8892074B2 (en) Multimedia messaging service center and method for caching mobile phone newspaper thereof
CN101977209A (en) Method for realizing page-turning synchronization on web page
CN102812744A (en) Inter-working of EFM-OAM and CFM-OAM for mobile backhaul networks
CN106027534A (en) System for implementing financial message processing based on Netty
CN103684974A (en) Mail processing method and system
CN107145535A (en) Instant communicating method and device and server
CN103841181A (en) Local area network multi-threading file transmission method
CN107368334A (en) A kind of business plug-in unit interactive system and method
CN101557354A (en) Method for sending picture by client service personnel on line
CN103796191A (en) Method, device and terminal for sending data to user terminal
US11240138B2 (en) Management of network connections
CN105515947B (en) A kind of method, server and the system of the heterogeneous terminals message intercommunication based on XMPP
CN103533001A (en) Communication method and communication system based on HTTP multi-proxy, and intermediate proxy server
CN104580420B (en) A kind of data transmission system and method across IDC
CN206226468U (en) Based on the instant communicating system that websocket is realized
CN101330664A (en) Method, system and apparatus for realizing multimedia business
CN107835150A (en) A kind of full media customer service dispatching method and system

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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20170908