CN102843312B - The sending and receiving method of instant message and device - Google Patents
The sending and receiving method of instant message and device Download PDFInfo
- Publication number
- CN102843312B CN102843312B CN201210291598.5A CN201210291598A CN102843312B CN 102843312 B CN102843312 B CN 102843312B CN 201210291598 A CN201210291598 A CN 201210291598A CN 102843312 B CN102843312 B CN 102843312B
- Authority
- CN
- China
- Prior art keywords
- message
- message content
- content
- recipient
- complex
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Landscapes
- Information Transfer Between Computers (AREA)
Abstract
This application provides a kind of sending method of instant message and the method for reseptance of device and a kind of instant message and device, wherein, described sending method comprises: obtain the instant message information that user sends, described instant message information comprises: message content body and message content types, and, recipient's information; Generating messages head; According to different message content types, respectively the message content body of correspondence and message content types are constructed basic messae body BODY objects as two leaf nodes; According to described basic messae body BODY object formation complex message body BODY object, it is the leaf node of null value that described complex message body BODY object comprises sign message content body; Be message object by described message header and complex message body BODY object encapsulation; Described message object is sent according to described recipient's information.The application can be used for reducing the network congestion in instant message transport process, and saves the System and Network resource in instant message transport process.
Description
Technical field
The application relates to IMS(IPMultimediaSubsystem, IP Multimedia System) technical field, particularly relate to a kind of sending method of instant message, a kind of dispensing device of instant message, a method of reseptance for instant message, and, a kind of receiving system of instant message.
Background technology
Instant message be the information non-memory that sender is sent be transmitted to the one service of recipient, be that instant message is directly mutual between receiving terminal and transmitting terminal from the different of email message.
Based on SIP(SessionInitiationProtocol, conversation initialized protocol) IMS(IPMultimediaSubsystem, IP Multimedia System) framework is that instant message constructs one and well realizes environment.In the ims environment, the realization of instant message has two kinds of methods substantially, the MESSAGE(message based on SIP) method, another kind is the method realized based on IMS conversation mechanism, and they are all realize under the IMS ability framework of 3GPPTS22.228 definition.Under the MESSAGE method mechanism of IMS, recipient can receive message in real time or quasi real time.And under conversation-based mechanism, the message that user receives is generally quasi real time, first set up session connection between recipient and sender, then can carry out the transmission of message, the content transmitting information can be text, image, audio or video.As shown in Figure 1, message (messaging) can be divided into two types by the difference according to the mode of sending: one is instant message (instantmessaging, IM), and namely message is immediately passed to recipient, close to real-time transmission after sending; Another is then insensitive to delivery time of message, and message is preserved by network and sent in certain time subsequently, can be referred to as mailbox type messaging service (mailboxmessaging).The application discusses mainly for instant message.
Instant message can be further divided into two seed categories, the instant message of non-session pattern (Page-mode and LargeMessage-mode) and the instant message of conversation modes (Session-Mode), as shown in Figure 2.The instant message of non-session pattern adopts different patterns according to the size sending message, and one is Page-mode pattern, and message directly sends with the MESSAGE method of SIP; Another kind is LargeMessage-mode pattern, and in this mode, message size exceedes default size, as more than 1300 bytes, by MSRP(MessageSessionRelayProtocol, message session trunk protocol) carry out the transmission of message.First the instant message of conversation modes then will set up a session before transmission message, then used MSRP to carry out the transmission of message.
In existing implementation, a kind of method that instant message transmits is indirect referencing method.The thought that realizes of indirect referencing method is when terminal needs the instant message comprising basic text message, accessory information and other extended field to be sent to one or more recipient, use HTTP(hypertexttransportprotocol, HTTP) or other transportation protocol based on congestion control mechanism the content topic of request is stored on a station server, this server is generally http server.And insert a link in the request, this link can be linked on stored request content address, instead of whole content is put in instant message.Then send a message to receiving terminal, receiving terminal adopts appropriate ways from downloading contents server after receiving request.
Because http protocol is stateless protocol, if subsequent treatment needs information above, then it must retransmit, and each data volume transmitted that connects may be caused like this to increase, cause network congestion.On the other hand, http protocol is connectionless agreement, each connection needs client first to send request, receive response, then disconnect, and a new TCP(TransmissionControlProtocol is all opened in each http session, transmission control protocol) connect, this is the waste to System and Network resource.
The technical problem needing those skilled in the art urgently to solve at present is exactly: when the instant message comprising basic text message, accessory information and other extended field is sent to one or more recipient, how to reduce network congestion, save the transmission that System and Network resource realizes instant message.
Summary of the invention
Technical problems to be solved in this application are to provide a kind of sending method of instant message and the method for reseptance of device and a kind of instant message and device, in order to reduce the network congestion in instant message transport process, and the System and Network resource in instant message transport process can be saved.
In order to solve the problem, this application discloses a kind of sending method of instant message, comprising:
Obtain the instant message information that user sends, described instant message information comprises: message content body and message content types, and, recipient's information;
Generating messages head;
According to different message content types, respectively the message content body of correspondence and message content types are constructed basic messae body BODY objects as two leaf nodes;
According to described basic messae body BODY object formation complex message body BODY object, it is the leaf node of null value that described complex message body BODY object comprises sign message content body;
Be message object by described message header and complex message body BODY object encapsulation;
Described message object is sent according to described recipient's information.
Preferably, described instant message information also comprises operation expanding information, and described message header comprises message content properties information, and the described step according to basic messae body BODY object formation complex message body BODY object comprises:
By the operation expanding information of described basic messae body BODY object and correspondence, message header information is as three leaf nodes structure message body key element BODYPART objects;
By described message body key element BODYPART object and message content properties information structuring complex message body BODY object, and interpolation sign message content is the leaf node of null value in described complex message body BODY object.
Preferably, when recipient's quantity is greater than 1, described message header and complex message body BODY object encapsulation be the step of message object before, also comprise:
Using recipient's list as leaf node structure recipient list BODY object;
The described step according to basic messae body BODY object formation complex message body BODY object also comprises:
Described recipient's list BODY object is added in described complex message body BODY object.
Preferably, described step of adding described recipient's list BODY object in complex message body BODY object comprises:
The operation expanding information of described recipient's list BODY object and correspondence is constructed recipient's list elements BODYPART objects as two leaf nodes;
By described recipient's list elements BODYPART object, message body key element BODYPART object and message content properties information structuring complex message body BODY object, and interpolation sign message content is the leaf node of null value in described complex message body BODY object.
Preferably, described message content body comprises text message content, and/or, annex message content; Described message content types comprises audio types, video type, sends message report type, picture/mb-type, common Session Description Protocol type of message and text type.
The embodiment of the present application also discloses a kind of method of reseptance of instant message, comprising:
Recipient's receipt message object, described message object comprises message header and message body BODY object;
Resolve described message header;
Resolve described message body BODY object, comprise following sub-step:
S1, judges in described message body BODY object, whether message content body is null value; If so, then perform sub-step S2, if not, then perform sub-step S3;
S2, judges that described message body BODY object is as complex message body BODY object, extracts message body BODY object from described complex message body BODY object, performs sub-step S1;
S3, judges that described message body BODY object is as basic messae body BODY object, extracts message content types and message content body from described basic messae body BODY object, performs sub-step S4;
S4, adopts described message content types to read message content body.
Preferably, the step of described employing message content types reading message content body comprises:
If described message content types is audio types, audio decoder process is carried out to described message content body, obtain audio content;
If described message content types is video type, video decode process is carried out to described message content body, obtain video content;
If described message content types, for sending message report type, being resolved the XML (extensible Markup Language) xml formatted data in described message content body, obtaining and sending message report, and described transmission message report is shown;
If described message content types is picture/mb-type, described message content body is decoded, obtain image content, and described image content is preserved;
If described message content types is common Session Description Protocol type of message, according to common Session Description Protocol, described message content body is resolved, obtain Session Description Protocol message;
If described message content types is text type, the text message in described message content body is directly shown.
The embodiment of the present application also discloses a kind of dispensing device of instant message, comprising:
Instant message data obtaining module: for obtaining the instant message information that user sends, described instant message information comprises: message content body and message content types, and, recipient's information;
Message header generation module: for generating messages head;
Basic messae body object generation module: for message content body corresponding for different message content types and message content types are constructed basic messae body BODY objects as two leaf nodes;
Complex message body object generation module: for by described basic messae body BODY object formation complex message body BODY object, described complex message body BODY object comprises that to characterize message content be the leaf node of null value;
Message object generation module: for being message object by described message header and complex message body BODY object encapsulation;
Message object sending module: for sending described message object according to described recipient's information.
Preferably, described instant message information also comprises operation expanding information, and described message header comprises message content properties information, and described complex message body object generation module comprises:
Message body feature object generates submodule: for the operation expanding information by described basic messae body BODY object and correspondence, and message header information is as three leaf node structure message body key element BODYPART objects;
First complex message body object generates submodule: for by described message body key element BODYPART object and message content properties information structuring complex message body BODY object, and in described complex message body BODY object, add that to characterize message content be the leaf node of null value.
Preferably, when recipient's quantity is greater than 1, described device also comprises:
Recipient's list object generation module: for recipient's list is constructed recipient's list BODY object as leaf node;
Described complex message body object generation module also comprises:
Recipient's list object generates submodule: for adding described recipient's list BODY object in described complex message body BODY object.
Preferably, described recipient's list object generation submodule comprises:
Recipient's list elements object generation unit: for the operation expanding information of described recipient's list BODY object and correspondence is constructed recipient's list elements BODYPART objects as two leaf nodes;
Second complex message body object generation unit: for by described recipient's list elements BODYPART object, message body key element BODYPART object and message content properties information structuring complex message body BODY object, and in described complex message body BODY object, add that to characterize message content be the leaf node of null value.
The embodiment of the present application also discloses a kind of receiving system of instant message, comprising:
Message object receiver module: for recipient's receipt message object, described message object comprises message header and message body BODY object;
Message header parsing module: for resolving described message header;
Message body analysis of object module: for resolving described message body BODY object, wherein, message body analysis of object module comprises following submodule:
Message content body judges submodule: for judging that in described message body BODY object, whether message content body is null value, if so, then calls the first message body object handles submodule, if not, then call the second message body object handles submodule;
First message body object handles submodule: for judging that described message body BODY object is as complex message body BODY object, extracts message body BODY object from described complex message body BODY object, returns and calls described message content body and judge submodule;
Second message body object handles submodule: for judging that described message body BODY object is as basic messae body BODY object, extracts message content types and message content body from described basic messae body BODY object, and message call Context resolution submodule;
Message content analyzing sub-module: for reading message content body according to described message content types.
Preferably, described message content analyzing sub-module comprises:
Audio treatment unit: when being audio types for described message content types, carries out audio decoder process to message content, obtains audio content;
Video processing unit: when being video type for described message content types, carries out video decode process to message content, obtains video content;
Send message report processing unit: during for described message content types for sending message report type, XML (extensible Markup Language) xml formatted data in described message content body is resolved, obtain and send message report, and described transmission message report is shown;
Picture processing unit: when being picture/mb-type for described message content types, decodes to described message content body, obtains image content, and is preserved by described image content;
Session Description Protocol message processing unit: when being common Session Description Protocol type of message for described message content types, resolves described message content body according to common Session Description Protocol, obtains Session Description Protocol message;
Text-processing unit: when being text type for described message content types, directly shows the text message in described message content body.
Compared with prior art, the application comprises following advantage:
The application is in the sending method of instant message, and utilize in the face of object thought encapsulates message body, the generation of the similar one tree of its process, then sends packaged instant message.In the method for reseptance of instant message, utilize the thought of recurrence to resolve the instant message received, the traversal of the similar one tree of its process, complete and the message content of instant message is resolved.
Because in the process of transmitting of instant message, first construct the leaf of tree, multiple leaf forms one tree; Then this tree generated is re-used as the leaf of new tree, until all message has all been encapsulated, then packaged message is sent, and each instant message transport process can transmit this message content, also encapsulated and the message be conveyed through before can transmitting, without the need to again uploading, so message body has good packaging effects, and message has very high reusability, thus decrease the network congestion that mass data in instant message transport process repeats transmission and generation.Meanwhile, in the receiving course of instant message, first from the root node of tree, whole of the traversal of recurrence tree, resolves until all nodes having traveled through tree complete the message content of instant message successively.Do not need to connect in the transmission of whole instant message and receiving course, but a first encapsulation messages, then directly transmit, after receiving, directly resolve the process obtaining message content, achieve simple, efficient, thus save System and Network resource.
Accompanying drawing explanation
Fig. 1 is the structural representation of messaging service classification;
Fig. 2 is the structural representation of IMS instant messaging classification;
Fig. 3 is sending method embodiment 1 flow chart of steps of a kind of instant message of the application;
Fig. 4 is the code schematic diagram of the instant message form of standard;
Fig. 5 is the code schematic diagram of the instant message form of expansion;
Fig. 6 is the application schematic diagram of the sending method embodiment 1 of a kind of instant message of the application;
Fig. 7 is sending method embodiment 2 flow chart of steps of a kind of instant message of the application;
Fig. 8 is method of reseptance embodiment 1 flow chart of steps of a kind of instant message of the application;
Fig. 9 is the structural representation of the dispensing device embodiment 1 of a kind of instant message of the application;
Figure 10 is the structural representation of the receiving system embodiment 1 of a kind of instant message of the application.
Embodiment
For enabling above-mentioned purpose, the feature and advantage of the application more become apparent, below in conjunction with the drawings and specific embodiments, the application is described in further detail.
One of core concept of the application is, in the sending method of instant message, and the generation of the similar one tree of process of structure message body.First construct the leaf of tree, multiple leaf forms one tree; Then this tree generated is re-used as the leaf of new tree, until all message all encapsulated.In the method for reseptance of instant message, resolve the traversal of the similar one tree of process of message object.First, from the root node of tree, whole of the traversal of recurrence tree successively, until all nodes having traveled through tree complete the parsing to instant message.
With reference to Fig. 3, show the flow chart of steps of the sending method embodiment 1 of a kind of instant message of the application, specifically can comprise the following steps:
Step 101, obtain the instant message information that user sends, described instant message information comprises: message content body and message content types, and, recipient's information.
In practice, described message content body can comprise text message content, and/or, annex message content.Described message content types can comprise audio types, video type, sends message report type, picture/mb-type, common Session Description Protocol type of message and text type etc.Furthermore, described message content types can comprise the type that RFC2045, RFC2046 and RFC3862 agreement is supported.
As a kind of embody rule of the embodiment of the present application, in the ims network, IMS terminal can use SIPMESSAGE to receive/transfer immediate news, message content mainly comprises: sip message head, recipient's list, operation expanding field, message body text and message body annex.In message content, except sip message head, other part is selectable items, is the part of message body.Due to the needs of instant messaging, as terminal simultaneously give multiple user send out message time, can with message sink list in message body, and the need of business information such as delivery reports, can carry a part of service related information in message body, this part information is referred to as " operation expanding field ".The standard instant message that instant messaging platform, client send except supporting IMS terminal, can also support to expand rear instant message.The form that the difference of two kinds of message is mainly reflected in message body portion is different, and the instant message form of standard as shown in Figure 4.The instant message form of expansion then as shown in Figure 5.
Can see from Fig. 4 and Fig. 5, the message header of the instant message form of standard and the instant message form of expansion is all SIPMESSAGE standard message head, unlike the form of message body in MESSAGE message.Carry basic information in the instant message of standard, message header and message body are not all expanded; Instant message after expansion is then expanded message physique formula.Its form adopts MIME(MultipurposeInternetMailExtensions, multipurpose internet mail is expanded) nested CPIM(CommonPresenceandInstantMessaging, publicly to attend and instant message specification) form, the formation of the instant message namely expanded is: sip message head+MIME message body (namely message format adopts the message body of MIME form).
Step 102, generating messages head.
The instant message that user is sent by terminal, can be an object by instant message total abstract, be called MESSAGE message object, this message object can comprise message header and message body.In the preferred a kind of embodiment of the application, message header can be the message header of standard, also can be the message header of expansion.Such as, based under the IMS environment of SIP, what instant messaging platform generated for the instant message of standard is the sip message head of standard, and what generate for the instant message after expansion is the sip message head of expansion.
Step 103, according to different message content types, constructs basic messae body BODY objects using the message content body of correspondence and message content types as two leaf nodes respectively.
In specific implementation, a basic messae body BODY object can comprise two leaves, and one is message content, and one is message content types.According to different message content types, i.e. audio types, video type, send message report type, picture/mb-type, common Session Description Protocol type of message and text type etc., construct basic messae body BODY objects using the message content body of often kind of message content types in message and correspondence thereof as two leaf nodes respectively.
Basic messae body BODY object can be used for representing a complete message body, can be complete MIME message body, also can be a complete CPIM message body (i.e. the message body of message format employing CPIM form).Each message object comprises a message body BODY object as member, and each basic messae body BODY object can comprise two members, message content types and message content body, and wherein each member can be all empty.
Specifically:
Message content types (Content-typeHeader): the type that may be used for the message body defined described by message body BODY object.Message content types value is generally discrete type, the i.e. message content types of basic messae body BODY object, as audio types (audio), video type (video), sends message report type, picture/mb-type (image), common Session Description Protocol type of message (sdp) and text type (text) etc.
Message content body (BodyString): may be used for preserving the message content string variable in message body BODY object corresponding to message content types, can be text or binary message.
Step 104, according to described basic messae body BODY object formation complex message body BODY object, it is the leaf node of null value that described complex message body BODY object comprises sign message content body.
In a preferred embodiment of the present application, described instant message information can also comprise operation expanding information, such as, the need of the business information of delivery report; Can comprise message content properties information in described message header, described message content properties information may be used for defining the message body type described by complex message body BODY object; In this case, described step 104 can comprise following sub-step:
Sub-step S11, by the operation expanding information of described basic messae body BODY object and correspondence, message header information is as three leaf nodes structure message body key element BODYPART objects;
Sub-step S12, by described message body key element BODYPART object and message content properties information structuring complex message body BODY object, and interpolation sign message content body is the leaf node of null value in described complex message body BODY object.
In specific implementation, a complex message body BODY object can comprise three leaves: message content body, message content properties information and the list of message body key element, and wherein each member can be all empty.
Specifically:
Message content properties information: the type that may be used for the message body defined described by complex message body BODY object.The message content types value of complex message body BODY object can be compound, as information type (message), and multicomponent type (multipart) etc.
Message content body (BodyString): for preserving the string variable of message content in message body BODY object, can be text or binary message.And for complex message body BODY object, the value of its message content body is empty.
Message body key element list (BodyPartList): the list that can be used for representing message body key element BODYPART object, its value can be empty, also can be the list that multiple message body key element BODYPART object forms.
Wherein, described message body key element BODYPART object can be used for the combination of describing message body BODY object and message header information, wherein message header information (Header) can be standard message head, also can be the message header of expansion, described message body key element BODYPART object can comprise three members, message header information, operation expanding information and message body BODY object (can be basic messae body BODY object or complex message body BODY object), wherein each member can be all empty.
Message header information (OtherHeader): for describing the information of the message header of all kinds of expansion.
Operation expanding information (Content-dispositionHeader): for being described message body, can indicate message body and whether be presented to user, and recipient can not identification message body type time processing mode.
Message body BODY object (BodyObj): each message body key element BODYPART object can have a message body BODY object as member.
Described message header and complex message body BODY object encapsulation are message object by step 105.
In a kind of example of the embodiment of the present application embody rule, on instant messaging platform, the complex message body BODY object that message header step 102 generated and step 104 generate encapsulates, and is the message object being about to send to recipient.
Step 106, sends described message object according to described recipient's information.
In a kind of example of the embodiment of the present application embody rule, according to the recipient's information in instant message information, by the MESSAGE method in Session Initiation Protocol, described message object is sent.
With reference to a kind of schematic diagram applying the embodiment of the present application structure message object shown in figure 6, suppose that in the message provided, fundamental type is text type and the picture/mb-type with annex, concrete steps are as follows:
1) obtain the instant message information that user sends, described instant message information comprises: message content body and message content types, and, recipient's information.
2) generating messages head.
3) the basic messae body BODY object that message body type is fundamental type (i.e. text type and picture/mb-type) is constructed.The value of its message content body is respectively content of text and the picture content information after coded treatment.Message body content type is respectively text and picture.
4) using the member of two of above-mentioned structure basic messae body BODY objects as message body key element BODYPART object, the message body key element BODYPART object of two kinds of message content types is constructed respectively.If there is extended message head in instant message, so using extended message head as message header information, form the message body key element BODYPART object of corresponding message content types with operation expanding information.
5) complex message body BODY object is become with two of above-mentioned structure message body key element BODYPART objects with message content properties information structuring.Wherein, in complex message body BODY object, the value of message content body is empty.
6) step 2 is repeated) and 3), until the entire message body construction complete except message sink list, be final message body BODY object.
7) be message object by described message header and final message body BODY object encapsulation.
8) described message object is sent according to described recipient's information.
With reference to Fig. 7, the flow chart of steps of the sending method embodiment 2 of a kind of instant message of the application is shown, in the present embodiment, recipient's quantity is greater than 1, and the present embodiment specifically comprises the following steps:
Step 201, obtain the instant message information that user sends, described instant message information comprises: message content body and message content types, and, recipient's information;
Step 202, generating messages head;
Step 203, according to different message content types, constructs basic messae body BODY objects using the message content body of correspondence and message content types as two leaf nodes respectively;
Step 204, according to described basic messae body BODY object formation complex message body BODY object, it is the leaf node of null value that described complex message body BODY object comprises sign message content body;
Step 205, using recipient's list as leaf node structure recipient list BODY object.
When terminal sends out message to multiple user simultaneously, with message receiver user list inside message body, using recipient's list as message content body (BodyString), leaf node structure recipient list BODY object can be.
Step 206, adds described recipient's list BODY object in described complex message body BODY object.
In a preferred embodiment of the present application, described step 206 can comprise following sub-step:
Sub-step S21, constructs recipient's list elements BODYPART objects using the operation expanding information of described recipient's list BODY object and correspondence as two leaf nodes.
Sub-step S22, by described recipient's list elements BODYPART object, message body key element BODYPART object and message content properties information structuring complex message body BODY object, and interpolation sign message content is the leaf node of null value in described complex message body BODY object.
Described message header and complex message body BODY object encapsulation are message object by step 207;
Step 208, sends described message object according to described recipient's information.
The present embodiment and above-mentioned difference embodiment illustrated in fig. 5 are, when adding when 1 be greater than for recipient's quantity, and the encapsulation process of message object.Instant message can be sent to multiple recipient by the present embodiment in real time, achieves effective transmission application of instant message simply, efficiently.
In a kind of Application Example of the application, when the instant message comprising basic text message, accessory information and other extended field is sent to one or more recipient, based on Session Initiation Protocol MESSAGE method, the sending method of instant message first can be adopted to transfer immediate news, the method for reseptance of instant message then can be adopted to receive instant message.Concrete example, user A writes an instant message HelloWorld in terminal, and simultaneously additional oneself a recent photograph in instant message, prepares good friend B, C and D of this instant message being sent to she.
1) instant message that user A sends is obtained.
2) generating messages head.
3) message content body (HelloWorld) and message content types (text type) are configured to basic messae body BODY object, as the leaf of tree.The message header information of text message is text, is another leaf of tree; These two leaf nodes are configured to message body key element BODYPART object, form the tree that comprises two leaf nodes.
4) message content body (treated pictorial information) and message content types (picture/mb-type) are configured to basic messae body BODY object, as the leaf of tree.The message header information of this image information is type of attachment, is another leaf of tree; These two leaf nodes are configured to the message body key element BODYPART object met the demands, form the tree that another comprises two leaf nodes.
5) setting two leaves as new tree using two that construct in above-mentioned two steps, is complex message body BODY object with message content properties information leaf construct, forms a newly tree; Material is thus formed MIME message body.
6) the complex message body BODY object will generated in step 5), becomes message body key element BODYPART object with other extension header field leaf construct, forms one tree; Then, be the complex message body BODY object met the demands by this tree and message content properties information leaf construct, form a newly tree; The new tree of above-mentioned generation and message header information leaf are configured to message body key element BODYPART object again, form one tree.This tree constructed is CPIM message body.
7) recipient's lists construction is become recipient's list BODY object, wherein message content body is list B, C and D of all recipients; Then, be recipient's list elements BODYPART object by recipient's list BODY object formation; Using the leaf of above-mentioned recipient key element BODYPART object as tree, be configured to final complex message body BODY object with the CPIM message body constructed in step 6 step.
8) complex message body BODY object step 7) constructed and message header, as message object, use the MESSAGE method in Session Initiation Protocol that instant message is sent to B, C and D.
With reference to Fig. 8, the flow chart of steps of the method for reseptance embodiment 1 of a kind of instant message of the application is shown, the embodiment of the present application adopts the thought of recurrence to resolve instant message, whether the end condition of recurrence is the message content body of message body BODY object is null value, if be null value, so illustrate that this node is not leaf node, continue recurrence; If be not null value, illustrate that this node is the leaf node of tree, so the message content body of this node is parsed preservation, and return its father node of process, then resolve, until all nodes are all parsed.
The present embodiment specifically can comprise the steps:
Step 301, recipient's receipt message object, described message object comprises message header and message body BODY object.
In the application example of the embodiment of the present application, after described message object is sent out, pass to all recipients in recipient's information immediately, the load mode of instant message close to real-time transmission, as based on the transmission under the MESSAGE method of SIP.After described message object is resolved, comprise message header and message body BODY object.In the application example of the embodiment of the present application, based under the MESSAGE method of SIP, message header is the sip message head of standard, and message body BODY object is MIME message body BODY object (namely message body form is the message body BODY object of MIME form) or CPIM message body BODY object (namely message body form is the message body BODY object of CPIM form).
Step 302, resolves described message header.
In a kind of practical application of the embodiment of the present application, based under the MESSAGE method of SIP, message header is the sip message head of standard, completes the parsing to described message header by Session Initiation Protocol stack.
Step 303, resolve described message body BODY object, comprise following sub-step:
Sub-step S31, judges in described message body BODY object, whether message content body is null value; If so, then perform sub-step S32, if not, then perform sub-step S33;
Sub-step S32, judges that described message body BODY object is as complex message body BODY object, extracts message body BODY object from described complex message body BODY object, performs sub-step S31;
The step extracting message body BODY object described in sub-step S32 from complex message body BODY object comprises: resolve the message body key element BODYPART object in described complex message body BODY object, extract the message body BODY object in described message body key element BODYPART object.
Sub-step S33, judges that described message body BODY object is as basic messae body BODY object, extracts message content types and message content body from described basic messae body BODY object, performs sub-step S34;
Sub-step S34, adopts described message content types to read message content body.
Concrete, carry out different handling processes according to described message content types, complete the parsing to message content body.Sub-step S34 comprises:
If described message content types is audio types, audio decoder process is carried out to described message content body, obtain audio content;
If described message content types is video type, video decode process is carried out to described message content body, obtain video content;
If described message content types, for sending message report type, being resolved the XML (extensible Markup Language) xml formatted data in described message content body, obtaining and sending message report, and described transmission message report is shown;
If described message content types is picture/mb-type, described message content body is decoded, obtain image content, and described image content is preserved;
If described message content types is common Session Description Protocol type of message, according to common Session Description Protocol, described message content body is resolved, obtain Session Description Protocol message;
If described message content types is text type, the text message in described message content body is directly shown.
In a kind of Application Example of the application, the receiving course of instant message can be completed according to the instant message method of reseptance of the application, after the instant message comprising basic text message, accessory information and other extended field is sent to one or more recipient, based on Session Initiation Protocol MESSAGE method, the method for reseptance of instant message can be adopted to receive instant message.Concrete example, user A writes an instant message HelloWorld in terminal, and simultaneously additional oneself a recent photograph in instant message, sends good friend B, C and D of giving her by this instant message.In reality, what user A sent is the message object be configured to by this instant message.
After recipient B, C and D receive above-mentioned message object, concrete steps are as follows:
1) described message object is resolved to two parts, i.e. message header and message body BODY object.
2) message header is resolved.Because the head that the Session Initiation Protocol that message header is standard is supported, so complete parsing by Session Initiation Protocol stack.
3) resolve described message body BODY object, concrete step is:
Judge that in described message body BODY object, whether message content body is null value, if so, then performs step 4), if not, then performs step 5).
4) in described message body BODY object, message content body is null value, so illustrate that this node is not leaf node, described message body object is complex message body BODY object, extracts the message body BODY object in described complex message body BODY object, performs step 3).
5) in described message body BODY object, message content body is not null value, and illustrate that this node is the leaf node of tree, described message body object is basic messae body BODY object, extracts the message content types in described message body BODY object.
6) according to described message content types, this node messages content body is read out preservation, then return its father node of process, then resolve, until all leaf nodes are all parsed.Finally, the instant message content demonstrated is text message-HelloWorld and image content-photo.
It should be noted that, for embodiment of the method, in order to simple description, therefore it is all expressed as a series of combination of actions, but those skilled in the art should know, the application is not by the restriction of described sequence of movement, because according to the application, some step can adopt other orders or carry out simultaneously.Secondly, those skilled in the art also should know, the embodiment described in specification all belongs to preferred embodiment, and involved action and module might not be that the application is necessary.
With reference to Fig. 9, the structural representation of the dispensing device embodiment 1 of a kind of instant message of the application is shown, specifically can comprises as lower module:
Instant message data obtaining module 401, for obtaining the instant message information that user sends, described instant message information comprises: message content body and message content types, and, recipient's information.
Message header generation module 402, for generating messages head.
Basic messae body object generation module 403, for constructing basic messae body BODY objects using message content body corresponding for different message content types and message content types as two leaf nodes.
Complex message body object generation module 404, for by described basic messae body BODY object formation complex message body BODY object, described complex message body BODY object comprises that to characterize message content be the leaf node of null value.
Message object generation module 405, for being message object by described message header and complex message body BODY object encapsulation.
Message object sending module 406, for sending described message object according to described recipient's information.
In a preferred embodiment of the present application, described instant message information also comprises operation expanding information, and described message header comprises message content properties information, and described complex message body object generation module 404 can comprise following submodule:
Message body feature object generates submodule: for the operation expanding information by described basic messae body BODY object and correspondence, and message header information is as three leaf node structure message body key element BODYPART objects;
First complex message body object generates submodule: for by described message body key element BODYPART object and message content properties information structuring complex message body BODY object, and in described complex message body BODY object, add that to characterize message content be the leaf node of null value.
In a preferred embodiment of the present application, when recipient's quantity is greater than 1, described device can also comprise with lower module:
Recipient's list object generation module, for constructing recipient's list BODY object using recipient's list as leaf node.
In this case, described complex message body object generation module 404 can also comprise following submodule:
Recipient's list object generates submodule, for adding described recipient's list BODY object in described complex message body BODY object.
More preferably, described recipient's list object generation submodule can also comprise with lower unit:
Recipient's list elements object generation unit, for constructing recipient's list elements BODYPART objects using the operation expanding information of described recipient's list BODY object and correspondence as two leaf nodes.
Second complex message body object generation unit, for by described recipient's list elements BODYPART object, message body key element BODYPART object and message content properties information structuring complex message body BODY object, and in described complex message body BODY object, add that to characterize message content be the leaf node of null value.
With reference to Figure 10, the structural representation of the receiving system embodiment 1 of a kind of instant message of the application is shown, specifically can comprises as lower module:
Message object receiver module 501, for recipient's receipt message object, described message object comprises message header and message body BODY object.
Message header parsing module 502, for resolving described message header.
Message body analysis of object module 503, for resolving described message body BODY object, wherein, described message body analysis of object module 503 can also comprise following submodule:
Message content body judges submodule 5031, for judging that in described message body BODY object, whether message content body is null value, if so, then calls the first message body object handles submodule 5032, if not, then calls the second message body object handles submodule 5033.
First message body object handles submodule 5032, for judging that described message body BODY object is as complex message body BODY object, from described complex message body BODY object, extract message body BODY object, return and call described message content body and judge submodule 5031.
Second message body object handles submodule 5033, for judging that described message body BODY object is as basic messae body BODY object, message content types and message content body is extracted from described basic messae body BODY object, and message call Context resolution submodule 5034.
Message content analyzing sub-module 5034, for reading message content body according to described message content types.
In a preferred embodiment of the present application, described message content analyzing sub-module 5034 can comprise with lower unit:
Audio treatment unit, when being audio types for described message content types, carries out audio decoder process to message content, obtains audio content.
Video processing unit, when being video type for described message content types, carries out video decode process to message content, obtains video content.
Send message report processing unit, during for described message content types for sending message report type, XML (extensible Markup Language) xml formatted data in described message content body is resolved, obtains and send message report, and described transmission message report is shown.
Picture processing unit, when being picture/mb-type for described message content types, decodes to described message content body, obtains image content, and is preserved by described image content.
Session Description Protocol message processing unit, when being common Session Description Protocol type of message for described message content types, resolves described message content body according to common Session Description Protocol, obtains Session Description Protocol message.
Text-processing unit, when being text type for described message content types, directly shows the text message in described message content body.
For device embodiment, due to itself and embodiment of the method basic simlarity, so description is fairly simple, relevant part illustrates see the part of embodiment of the method.
Each embodiment in this specification all adopts the mode of going forward one by one to describe, and what each embodiment stressed is the difference with other embodiments, between each embodiment identical similar part mutually see.
Each embodiment in this specification all adopts the mode of going forward one by one to describe, and what each embodiment stressed is the difference with other embodiments, between each embodiment identical similar part mutually see.For device embodiment, due to itself and embodiment of the method basic simlarity, so description is fairly simple, relevant part illustrates see the part of embodiment of the method.
Those skilled in the art should understand, the embodiment of the application can be provided as method, system or computer program.Therefore, the application can adopt the form of complete hardware embodiment, completely software implementation or the embodiment in conjunction with software and hardware aspect.And the application can adopt in one or more form wherein including the upper computer program implemented of computer-usable storage medium (including but not limited to magnetic disc store, CD-ROM, optical memory etc.) of computer usable program code.
The application describes with reference to according to the flow chart of the method for the embodiment of the present application, equipment (system) and computer program and/or block diagram.Should understand can by the combination of the flow process in each flow process in computer program instructions realization flow figure and/or block diagram and/or square frame and flow chart and/or block diagram and/or square frame.These computer program instructions can being provided to the processor of all-purpose computer, special-purpose computer, Embedded Processor or other programmable data processing device to produce a machine, making the instruction performed by the processor of computer or other programmable data processing device produce device for realizing the function of specifying in flow chart flow process or multiple flow process and/or block diagram square frame or multiple square frame.
These computer program instructions also can be stored in can in the computer-readable memory that works in a specific way of vectoring computer or other programmable data processing device, the instruction making to be stored in this computer-readable memory produces the manufacture comprising command device, and this command device realizes the function of specifying in flow chart flow process or multiple flow process and/or block diagram square frame or multiple square frame.
These computer program instructions also can be loaded in computer or other programmable data processing device, make on computer or other programmable devices, to perform sequence of operations step to produce computer implemented process, thus the instruction performed on computer or other programmable devices is provided for the step realizing the function of specifying in flow chart flow process or multiple flow process and/or block diagram square frame or multiple square frame.
Although described the preferred embodiment of the application, those skilled in the art once obtain the basic creative concept of cicada, then can make other change and amendment to these embodiments.So claims are intended to be interpreted as comprising preferred embodiment and falling into all changes and the amendment of the application's scope.
Finally, also it should be noted that, in this article, the such as relational terms of first and second grades and so on is only used for an entity or operation to separate with another entity or operating space, and not necessarily requires or imply the relation that there is any this reality between these entities or operation or sequentially.And, term " comprises ", " comprising " or its any other variant are intended to contain comprising of nonexcludability, thus make to comprise the process of a series of key element, method, article or equipment and not only comprise those key elements, but also comprise other key elements clearly do not listed, or also comprise by the intrinsic key element of this process, method, article or equipment.When not more restrictions, the key element limited by statement " comprising ... ", and be not precluded within process, method, article or the equipment comprising described key element and also there is other identical element.
Above the sending method of the instant message that the application provides and device and method of reseptance and device are described in detail, apply specific case herein to set forth the principle of the application and execution mode, the explanation of above embodiment is just for helping method and the core concept thereof of understanding the application; Meanwhile, for one of ordinary skill in the art, according to the thought of the application, all will change in specific embodiments and applications, in sum, this description should not be construed as the restriction to the application.
Claims (11)
1. a sending method for instant message, is characterized in that, comprising:
Obtain the instant message information that user sends, described instant message information comprises: message content body and message content types, and, recipient's information;
Generating messages head;
According to different message content types, respectively the message content body of correspondence and message content types are constructed basic messae body BODY objects as two leaf nodes;
According to described basic messae body BODY object formation complex message body BODY object, it is the leaf node of null value that described complex message body BODY object comprises sign message content body;
When recipient's quantity is greater than 1, also comprise:
Using recipient's list as leaf node structure recipient list BODY object;
The described step according to basic messae body BODY object formation complex message body BODY object also comprises:
Described recipient's list BODY object is added in described complex message body BODY object;
Be message object by described message header and complex message body BODY object encapsulation;
Described message object is sent according to described recipient's information;
Wherein, in the transmission of whole instant message and receiving course, do not need between recipient and sender to set up session connection.
2. method according to claim 1, it is characterized in that, described instant message information also comprises operation expanding information, and described message header comprises message content properties information, and the described step according to basic messae body BODY object formation complex message body BODY object comprises:
By the operation expanding information of described basic messae body BODY object and correspondence, message header information is as three leaf nodes structure message body key element BODYPART objects;
By described message body key element BODYPART object and message content properties information structuring complex message body BODY object, and interpolation sign message content is the leaf node of null value in described complex message body BODY object.
3. method according to claim 1, is characterized in that, described step of adding described recipient's list BODY object in complex message body BODY object comprises:
The operation expanding information of described recipient's list BODY object and correspondence is constructed recipient's list elements BODYPART objects as two leaf nodes;
By described recipient's list elements BODYPART object, message body key element BODYPART object and message content properties information structuring complex message body BODY object, and interpolation sign message content is the leaf node of null value in described complex message body BODY object.
4. method according to claim 1 and 2, is characterized in that, described message content body comprises text message content, and/or, annex message content; Described message content types comprises audio types, video type, sends message report type, picture/mb-type, common Session Description Protocol type of message and text type.
5. a method of reseptance for instant message, is characterized in that, comprising:
Recipient's receipt message object, described message object comprises message header and message body BODY object;
Resolve described message header;
Resolve described message body BODY object, comprise following sub-step:
S1, judges in described message body BODY object, whether message content body is null value; If so, then perform sub-step S2, if not, then perform sub-step S3;
S2, judges that described message body BODY object is as complex message body BODY object, extracts message body BODY object from described complex message body BODY object, performs sub-step S1;
S3, judges that described message body BODY object is as basic messae body BODY object, extracts message content types and message content body from described basic messae body BODY object, performs sub-step S4;
S4, adopts described message content types to read message content body;
Wherein, in the transmission of whole instant message and receiving course, do not need between recipient and sender to set up session connection.
6. method as claimed in claim 5, is characterized in that, the step that described employing message content types reads message content body comprises:
If described message content types is audio types, audio decoder process is carried out to described message content body, obtain audio content;
If described message content types is video type, video decode process is carried out to described message content body, obtain video content;
If described message content types, for sending message report type, being resolved the XML (extensible Markup Language) xml formatted data in described message content body, obtaining and sending message report, and described transmission message report is shown;
If described message content types is picture/mb-type, described message content body is decoded, obtain image content, and described image content is preserved;
If described message content types is common Session Description Protocol type of message, according to common Session Description Protocol, described message content body is resolved, obtain Session Description Protocol message;
If described message content types is text type, the text message in described message content body is directly shown.
7. a dispensing device for instant message, is characterized in that, comprising:
Instant message data obtaining module: for obtaining the instant message information that user sends, described instant message information comprises: message content body and message content types, and, recipient's information;
Message header generation module: for generating messages head;
Basic messae body object generation module: for message content body corresponding for different message content types and message content types are constructed basic messae body BODY objects as two leaf nodes;
Complex message body object generation module: for by described basic messae body BODY object formation complex message body BODY object, described complex message body BODY object comprises that to characterize message content be the leaf node of null value;
When recipient's quantity is greater than 1, described device also comprises:
Recipient's list object generation module: for recipient's list is constructed recipient's list BODY object as leaf node;
Described complex message body object generation module also comprises:
Recipient's list object generates submodule: for adding described recipient's list BODY object in described complex message body BODY object;
Message object generation module: for being message object by described message header and complex message body BODY object encapsulation;
Message object sending module: for sending described message object according to described recipient's information;
Wherein, in the transmission of whole instant message and receiving course, do not need between recipient and sender to set up session connection.
8. device according to claim 7, is characterized in that, described instant message information also comprises operation expanding information, and described message header comprises message content properties information, and described complex message body object generation module comprises:
Message body feature object generates submodule: for the operation expanding information by described basic messae body BODY object and correspondence, and message header information is as three leaf node structure message body key element BODYPART objects;
First complex message body object generates submodule: for by described message body key element BODYPART object and message content properties information structuring complex message body BODY object, and in described complex message body BODY object, add that to characterize message content be the leaf node of null value.
9. device according to claim 7, is characterized in that, described recipient's list object generates submodule and comprises:
Recipient's list elements object generation unit: for the operation expanding information of described recipient's list BODY object and correspondence is constructed recipient's list elements BODYPART objects as two leaf nodes;
Second complex message body object generation unit: for by described recipient's list elements BODYPART object, message body key element BODYPART object and message content properties information structuring complex message body BODY object, and in described complex message body BODY object, add that to characterize message content be the leaf node of null value.
10. a receiving system for instant message, is characterized in that, comprising:
Message object receiver module: for recipient's receipt message object, described message object comprises message header and message body BODY object;
Message header parsing module: for resolving described message header;
Message body analysis of object module: for resolving described message body BODY object, wherein, message body analysis of object module comprises following submodule:
Message content body judges submodule: for judging that in described message body BODY object, whether message content body is null value, if so, then calls the first message body object handles submodule, if not, then call the second message body object handles submodule;
First message body object handles submodule: for judging that described message body BODY object is as complex message body BODY object, extracts message body BODY object from described complex message body BODY object, returns and calls described message content body and judge submodule;
Second message body object handles submodule: for judging that described message body BODY object is as basic messae body BODY object, extracts message content types and message content body from described basic messae body BODY object, and message call Context resolution submodule;
Message content analyzing sub-module: for reading message content body according to described message content types;
Wherein, in the transmission of whole instant message and receiving course, do not need between recipient and sender to set up session connection.
11. devices as claimed in claim 10, it is characterized in that, described message content analyzing sub-module comprises:
Audio treatment unit: when being audio types for described message content types, carries out audio decoder process to message content, obtains audio content;
Video processing unit: when being video type for described message content types, carries out video decode process to message content, obtains video content;
Send message report processing unit: during for described message content types for sending message report type, XML (extensible Markup Language) xml formatted data in described message content body is resolved, obtain and send message report, and described transmission message report is shown;
Picture processing unit: when being picture/mb-type for described message content types, decodes to described message content body, obtains image content, and is preserved by described image content;
Session Description Protocol message processing unit: when being common Session Description Protocol type of message for described message content types, resolves described message content body according to common Session Description Protocol, obtains Session Description Protocol message;
Text-processing unit: when being text type for described message content types, directly shows the text message in described message content body.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201210291598.5A CN102843312B (en) | 2012-08-15 | 2012-08-15 | The sending and receiving method of instant message and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201210291598.5A CN102843312B (en) | 2012-08-15 | 2012-08-15 | The sending and receiving method of instant message and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN102843312A CN102843312A (en) | 2012-12-26 |
CN102843312B true CN102843312B (en) | 2016-03-30 |
Family
ID=47370385
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201210291598.5A Active CN102843312B (en) | 2012-08-15 | 2012-08-15 | The sending and receiving method of instant message and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN102843312B (en) |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103929353B (en) * | 2014-04-25 | 2017-07-25 | 百度在线网络技术(北京)有限公司 | The treating method and apparatus of instant message |
CN104038407A (en) * | 2014-05-27 | 2014-09-10 | 小米科技有限责任公司 | Instant message management method and device |
CN105634684B (en) * | 2014-11-19 | 2019-04-19 | 中国移动通信集团广东有限公司 | A kind of processing method of data packet, device and server |
CN111083145A (en) * | 2019-12-18 | 2020-04-28 | 北京华宇信息技术有限公司 | Message sending method and device and electronic equipment |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1905704A (en) * | 2006-08-21 | 2007-01-31 | 华为技术有限公司 | Universal message system and implementing method thereof |
CN101296197A (en) * | 2008-06-30 | 2008-10-29 | 腾讯科技(深圳)有限公司 | Transmission method and system of instant communication information |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7383308B1 (en) * | 2004-02-11 | 2008-06-03 | Aol Llc, A Delaware Limited Liability Company | Buddy list-based sharing of electronic content |
-
2012
- 2012-08-15 CN CN201210291598.5A patent/CN102843312B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1905704A (en) * | 2006-08-21 | 2007-01-31 | 华为技术有限公司 | Universal message system and implementing method thereof |
CN101296197A (en) * | 2008-06-30 | 2008-10-29 | 腾讯科技(深圳)有限公司 | Transmission method and system of instant communication information |
Also Published As
Publication number | Publication date |
---|---|
CN102843312A (en) | 2012-12-26 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US8375094B2 (en) | Creating a message readable by a plurality of heterogeneous recipients | |
US7882533B2 (en) | Digital television application protocol for interactive television | |
US8849322B2 (en) | Systems and methods for sharing threaded conversations on mobile communications devices | |
US20080294729A1 (en) | Email object for open mobile alliance data synchronization usage | |
CN100401724C (en) | Method and device for transfer immediate news | |
KR101709791B1 (en) | Consolidating duplicate messages for a single destination on a computer network | |
CN102843312B (en) | The sending and receiving method of instant message and device | |
US20060176902A1 (en) | Method of processing a multimedia message, a storage medium, and an associated processing system | |
CN107580306B (en) | Method and system for forwarding multimedia message | |
CN102591870A (en) | Micro-blog based rich media derivation method, micro-blog terminal and micro-blog server terminal | |
US10257671B2 (en) | System and method of creating and providing SMS HTTP tagging | |
WO2012094945A1 (en) | Microblog message processing method and device thereof | |
CN100546307C (en) | The communication means that is used for digital television multimedia message system | |
CN105704001A (en) | WeChat server message distribution method and WeChat server message distribution system | |
CN103888348A (en) | E-mail application system and method and device for transferring E-mails | |
WO2014187397A1 (en) | Multimedia message publishing method and device | |
CN102025693B (en) | Method and device for reminding session | |
WO2012116565A1 (en) | Media message processing method and device | |
CN107634974A (en) | A kind of data transmission method and device | |
CN114222258B (en) | Method for realizing multimedia message communication between 5G message mobile phone and Beidou terminal | |
CN106330955B (en) | A kind of instant messaging extended method and system | |
WO2011157007A1 (en) | Method and device for adapting and forwarding multimedia data contents | |
CN116781653A (en) | Message processing method, device, electronic equipment, system and storage medium | |
US8176129B2 (en) | System and method of sending compressed html messages over telephony protocol | |
KR100766779B1 (en) | Wireless Instant Messaging System and Service Method with Extensible Presence Capability |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant |