CN110808950A - Message processing method and device, computer equipment and storage medium - Google Patents

Message processing method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN110808950A
CN110808950A CN201910911094.0A CN201910911094A CN110808950A CN 110808950 A CN110808950 A CN 110808950A CN 201910911094 A CN201910911094 A CN 201910911094A CN 110808950 A CN110808950 A CN 110808950A
Authority
CN
China
Prior art keywords
message
identifier
internet
things
type
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201910911094.0A
Other languages
Chinese (zh)
Other versions
CN110808950B (en
Inventor
邓利斌
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Xian Fibocom Wireless Software Inc
Original Assignee
Xian Fibocom Wireless Software Inc
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 Xian Fibocom Wireless Software Inc filed Critical Xian Fibocom Wireless Software Inc
Priority to CN201910911094.0A priority Critical patent/CN110808950B/en
Publication of CN110808950A publication Critical patent/CN110808950A/en
Application granted granted Critical
Publication of CN110808950B publication Critical patent/CN110808950B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/22Parsing or analysis of headers
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/12Protocols specially adapted for proprietary or special-purpose networking environments, e.g. medical networks, sensor networks, networks in vehicles or remote metering networks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/26Special purpose or proprietary protocols or architectures

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computing Systems (AREA)
  • Computer Security & Cryptography (AREA)
  • Health & Medical Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Medical Informatics (AREA)
  • Computer And Data Communications (AREA)

Abstract

The application relates to a message processing method, a message processing device, computer equipment and a storage medium. The method comprises the following steps: receiving an internet of things message sent by a second terminal, and analyzing the internet of things message to obtain a message identifier in the internet of things message; determining the message type of the message of the Internet of things according to the message identifier; and executing corresponding preset operation according to the message type. By adopting the scheme, the message type judgment process of the Internet of things can be simplified, and the message processing efficiency of the Internet of things is improved.

Description

Message processing method and device, computer equipment and storage medium
Technical Field
The present application relates to the field of internet of things technology, and in particular, to a message processing method and apparatus, a computer device, and a storage medium.
Background
With the development of computer technology, the development of internet of things is driven, and the internet of things technology refers to the functions of connecting an object with a network through information sensing equipment according to an agreed protocol, and performing information exchange and communication through an information transmission medium so as to realize intelligent identification, positioning, tracking, supervision and the like. The application scenes of the Internet of things comprise application scenes of smart home, building automation, industrial automation and the like.
LwM2M (Lightweight M2M) is a Protocol of a Lightweight Application layer, is mainly used for various Internet of things devices, and realizes Internet of things messaging based on a restricted Application Protocol (CoaP Protocol), however, in the current Internet of things message processing process, the message type judgment process of the Internet of things messages is complex and is prone to errors.
Disclosure of Invention
In view of the foregoing, it is necessary to provide a message processing method, an apparatus, a computer device, and a storage medium, which can improve message processing efficiency of the internet of things.
A message processing method is applied to a first terminal, and comprises the following steps:
receiving an Internet of things message sent by a second terminal;
analyzing the message of the Internet of things to obtain a message identifier in the message of the Internet of things;
determining the message type of the message of the Internet of things according to the message identifier;
and executing corresponding preset operation according to the message type.
In one embodiment, the internet of things message is a user datagram protocol based internet of things message.
In one embodiment, the internet of things message based on the user datagram protocol comprises a CoaP message.
In one embodiment, the determining the message type of the internet of things message according to the message identifier includes:
acquiring a first identifier and a second identifier of the message identifier, wherein the first identifier corresponds to at least one second identifier; the first identification is used for representing a protocol type; the second identification is used for representing the type of the message;
and determining the message type of the message of the Internet of things according to the first identifier and the second identifier.
In one embodiment, the first identifier is a preset first identifier; the determining the message type of the internet of things message according to the first identifier and the second identifier includes:
searching a preset second identifier corresponding to a first identifier from a corresponding relation between the preset first identifier and the preset second identifier;
comparing the second identifier with the preset second identifier;
and when the second identifier is the same as the preset second identifier, determining the message type of the message of the Internet of things.
A message processing apparatus, the apparatus comprising:
the receiving module is used for receiving the Internet of things message sent by the second terminal;
the analysis module is used for analyzing the message of the Internet of things to obtain a message identifier in the message of the Internet of things;
the determining module is used for determining the message type of the message of the Internet of things according to the message identifier;
and the execution module is used for executing corresponding preset operation according to the message type.
A computer device comprising a memory and a processor, the memory storing a computer program, the processor implementing the following steps when executing the computer program:
receiving an Internet of things message sent by a second terminal;
analyzing the message of the Internet of things to obtain a message identifier in the message of the Internet of things;
determining the message type of the message of the Internet of things according to the message identifier;
and executing corresponding preset operation according to the message type.
A computer-readable storage medium, on which a computer program is stored which, when executed by a processor, carries out the steps of:
receiving an Internet of things message sent by a second terminal;
analyzing the message of the Internet of things to obtain a message identifier in the message of the Internet of things;
determining the message type of the message of the Internet of things according to the message identifier;
and executing corresponding preset operation according to the message type.
The message processing method, the message processing device, the computer equipment and the storage medium receive the message of the internet of things sent by the second terminal; analyzing the message of the Internet of things to obtain a message identifier in the message of the Internet of things, and determining the message type of the message of the Internet of things according to the message identifier; each message identifier corresponds to one message type, when the type of the internet of things message is judged, only the message identifier in the internet of things message needs to be analyzed and obtained, the message type of the internet of things message can be determined by simply judging according to the message identifier, and further complex judgment on other data carried in the internet of things message is not needed; and executing corresponding preset operation according to the message type, accurately and quickly judging the type of the message of the Internet of things according to the message identifier when receiving a plurality of messages of the Internet of things, and executing the preset operation corresponding to each message type according to the message type, thereby improving the processing efficiency and accuracy of the message of the Internet of things.
A message processing method is applied to a second terminal, and comprises the following steps:
acquiring an Internet of things message to be sent;
adding a message identifier in the to-be-sent Internet of things message to obtain the Internet of things message containing the message identifier; the message identifier is used for determining the message type of the to-be-sent internet of things message;
and sending the message of the Internet of things containing the message identifier to the first terminal.
In one embodiment, the message identifier includes a first identifier and a second identifier, the first identifier is used for indicating a protocol type, and the second identifier is used for indicating a message type.
A message processing apparatus, the apparatus comprising:
the acquisition module is used for acquiring the message of the Internet of things to be sent;
the adding module is used for adding a message identifier into the to-be-sent Internet of things message to obtain the Internet of things message containing the message identifier; the message identifier is used for determining the message type of the to-be-sent internet of things message;
and the sending module is used for sending the Internet of things message containing the message identifier to the first terminal.
A computer device comprising a memory and a processor, the memory storing a computer program, the processor implementing the following steps when executing the computer program:
acquiring an Internet of things message to be sent;
adding a message identifier in the to-be-sent Internet of things message to obtain the Internet of things message containing the message identifier; the message identifier is used for determining the message type of the to-be-sent internet of things message;
and sending the message of the Internet of things containing the message identifier to the first terminal.
A computer-readable storage medium, on which a computer program is stored which, when executed by a processor, carries out the steps of:
acquiring an Internet of things message to be sent;
adding a message identifier in the to-be-sent Internet of things message to obtain the Internet of things message containing the message identifier; the message identifier is used for determining the message type of the to-be-sent internet of things message;
and sending the message of the Internet of things containing the message identifier to the first terminal.
According to the message processing method, the message processing device, the computer equipment and the storage medium, the message of the Internet of things to be sent is acquired; the message identification is added to the to-be-sent message of the internet of things to obtain the message of the internet of things containing the message identification, wherein the message identification is used for determining the message type of the to-be-sent message of the internet of things, the message of the internet of things containing the message identification is sent to the first terminal, the message identification is added to the message of the internet of things, different target messages can be distinguished according to the message identification, and the efficiency of judging the message type of the message of the internet of things is improved.
Drawings
FIG. 1 is a diagram of an application environment of a message processing method in one embodiment;
FIG. 2 is a flow diagram that illustrates a method for message processing in one embodiment;
fig. 3 is a schematic flow chart illustrating a message type determination step of the internet of things in one embodiment;
FIG. 4 is a flow chart illustrating a message processing method according to another embodiment;
FIG. 5 is an architecture diagram of the lightweight M2M protocol in the message processing method of one embodiment;
FIG. 6 is a flow diagram that illustrates a method for message processing in one embodiment;
FIG. 7 is a block diagram showing the structure of a message processing apparatus according to an embodiment;
FIG. 8 is a block diagram showing the construction of a message processing apparatus according to another embodiment;
FIG. 9 is a diagram illustrating an internal structure of a computer device according to an embodiment.
Detailed Description
The message processing method provided by the application can be applied to the application environment shown in fig. 1. Wherein the first terminal 102 communicates with the second terminal 104 via a network. The first terminal 102 receives the internet of things message sent by the second terminal 104, analyzes the internet of things message to obtain a message identifier in the internet of things message, determines a message type of the internet of things message according to the message identifier, and the terminal 102 executes corresponding preset operation according to the message type. The first terminal 102 may be, but is not limited to, various personal computers, laptops, smartphones, tablets and portable wearable devices, and the second terminal 104 may be, but is not limited to, various personal computers, notebooks, smartphones, tablets and portable wearable devices.
It is to be understood that the terms "first," "second," and the like as used herein may be used herein to describe various terminals, but these terminals are not limited by these terms. These terms are only used to distinguish a first terminal from another terminal. For example, a first terminal may be termed a second terminal, and, similarly, a second terminal may be termed a first terminal, without departing from the scope of the present application. The first terminal and the second terminal are both terminals, but they are not the same terminal.
In one embodiment, as shown in fig. 2, a message processing method is provided, which is described by taking the method as an example applied to the first terminal 102 in fig. 1, and includes the following steps:
step 202, receiving an internet of things message sent by the second terminal.
Wherein, the flow rate of the water is controlled by the control unit. The terminal may be various personal computers, notebook computers, smart phones, tablet computers, portable wearable devices, and the like, and the type of the terminal is not limited herein.
The message of the internet of things is interactive data transmitted based on a network application layer protocol. The internet of things message of the network application layer protocol is transmitted between the two terminals based on the communication protocol. The message of the internet of things is transmitted in a protocol format, the message of the internet of things comprises a message header and a message body, and the message header can comprise a protocol version number (Ver), a message type (T) of an application layer protocol, a function Code (Code), a Token, a message option (Options) and the like; wherein the length of the protocol version number can be 2 bits; the length of the message type of the protocol can be 2 bits; the length of Token may be 4 bits; the length of the function code is 8 bits, and the function code is divided into a first 3bit and a second 5bit, wherein the first 3bit represents the type, 0 represents a null message or a request code, and 2 the beginning represents a response code; the message types of the application layer protocol comprise an acknowledgement request CON, a NON-acknowledgement request NON, a response message ACK and a reset RST; the function codes comprise GET, PUT, POST and DELETE, and can realize the data check, change, addition and deletion of the server or the terminal. The message Options may include multiple Options, a Uniform Resource Identifier (URI), a CoAP host, a request parameter, a load type, and the like may be set in the Options, and the formats of the Options are a combination of "Tag + Length + Value", where Tag represents a number of the Option, Length represents a set byte Length, which may be 1 byte, and Value represents a set Option Value; the message body comprises a load (Payload), the load carries actual data content of the internet of things message, and when carrying data, a 16-system carrying mark OxFF needs to be added in front of the data. The message types of the internet of things comprise messages such as observer, discover, Read, Write, Execute, Parameter, Notify and the like.
In an embodiment, the message options of the message of the internet of things include multiple options, each Option may be arranged according to the number of the Option in the message of the internet of things, for example, the number of the Option1 in the message Option of the message of the internet of things is 15, the number of the Option2 is 10, the number of the Option3 is 20, and the arrangement sequence of the Option1, the Option2 and the Option3 is Option2, Option1 and Option 3. And the options are arranged in the number of the message of the Internet of things. The method can avoid conveniently searching the Option data and avoiding data loss.
And 204, analyzing the message of the Internet of things to obtain a message identifier in the message of the Internet of things.
The message identifier is a unique identifier for distinguishing message types, and different message identifiers corresponding to different message types are used. The message identification can be a number combination of binary 0 and 1, or a number and/or letter combination of 16-ary 0-F, and the like. The message types of the internet of things include observer, discover, Read, Write, Execute, Parameter, and Notify, for example, 0001 may represent the observer message, 0010 may represent the discover message, and 0011 may represent the Read message.
Specifically, the transmission of the message of the internet of things is realized through a format corresponding to an application layer protocol in the transmission process, and after the first terminal receives the message of the internet of things, the received message of the internet of things is analyzed through an analysis packet, so that a message identifier in a message option in a message header of the message of the internet of things is obtained.
In one embodiment, the message of the internet of things is encrypted through an encryption protocol at a network transmission layer, the first terminal triggers an ecdh _ pre _ master _ secret () function to generate a secret key after passing through identity verification through an authentication mechanism in a cache, the encrypted message of the internet of things is decrypted through the secret key, the decrypted message of the internet of things is analyzed, and a message identifier of a message option in the message of the internet of things is obtained. The encryption protocol may be a packet Transport Layer Security (DTLS), and the DTLS is based on a user data protocol.
And step 206, determining the message type of the Internet of things according to the message identification.
In particular, different message identities represent different message types, e.g. identity "0001" represents an observer message and "0100" represents a Read message.
And step 208, executing corresponding preset operation according to the message type.
Specifically, different message types correspond to different preset operations, the message identifier is obtained by analyzing the message of the internet of things through the data analysis packet, and the program is triggered to execute the preset operation corresponding to the message type according to the message type corresponding to the message identifier. The different message types correspond to different types of preset operations, for example, the message types of the internet of things include observer, discover, Read, Write, Execute, Parameter, Notify, and the like, where the preset operation corresponding to the observer includes a request start operation, a request cancel operation, and a response operation, the preset operation of the discover includes a request operation and a response operation, the preset operation of the Read includes a request operation and a response operation, the preset operation of the Write includes a request operation and a response operation, the preset operation of the Execute includes a request operation and a response operation, the preset operation of the Parameter includes a request operation and a response operation, and the preset operation of the Notify includes a report operation.
In one embodiment, a first terminal is connected with a second terminal through a network, the first terminal receives an internet of things message of the second terminal, a message identifier in a message option of the internet of things message is analyzed through an analysis packet, the type of the internet of things message determined according to the message identifier is Read temperature reading request operation, the first terminal responds to the Read request operation, and response data is returned in the form of the internet of things message through the network.
In the message processing method, the message of the internet of things sent by the second terminal is received; analyzing the message of the Internet of things to obtain a message identifier in the message of the Internet of things, and determining the message type of the message of the Internet of things according to the message identifier; each message identifier corresponds to one message type, when the type of the internet of things message is judged, only the message identifier in the internet of things message needs to be analyzed and obtained, the message type of the internet of things message can be determined by simply judging according to the message identifier, and further complex judgment on other data carried in the internet of things message is not needed; and executing corresponding preset operation according to the message type, accurately and quickly judging the type of the message of the Internet of things according to the message identifier when receiving a plurality of messages of the Internet of things, and executing the preset operation corresponding to each message type according to the message type, thereby improving the processing efficiency and accuracy of the message of the Internet of things.
In one embodiment, the internet of things message is a user datagram protocol based internet of things message.
The User Datagram Protocol (UDP) is a simple connectionless and unreliable Datagram oriented transport layer (transport layer) Protocol, and internet of things messages based on the UDP do not need to be connected before and after being sent, so that overhead and message sending delay are reduced.
In one embodiment, the user datagram protocol based internet of things message comprises a CoaP message.
The restricted Application Protocol (CoaP) message is transmitted based on the UDP Protocol, the CoaP Protocol is a complete binary Application Protocol, the CoaP Protocol has a message header, and a single-byte separator 0xFF is used for isolation between the Payload (Payload) and the message header. The CoaP protocol version number Ver, the label length indication TKL, the standard Code and the Message sequence number Message ID in the Message header are necessary filling parts, and the CoAP load can contain different media types: binary, text, Extensible Markup Language (XML), JS Object Notation (JSON), CBOR, and the like.
Specifically, a CoaP message sent by a second terminal is received, the CoaP message is analyzed through a message analysis packet, a message identifier in message option Options in the CoaP message is obtained, and the message type of the CoaP message is determined according to the obtained message identifier, wherein the message type of the CoaP message comprises observer, discover, Read, Write, Execute, Parameter, Notify and the like; and executing corresponding preset operation according to the message type, acquiring the message identifier in the CoaP message through analysis, directly determining the message type by the message identifier, and improving the processing efficiency of the message of the Internet of things without performing complicated judgment on the message type.
In an embodiment, as shown in fig. 3, a message type determining step of an internet of things message is provided, which is described by taking the method as an example applied to the first terminal 102 in fig. 1, and includes the following steps:
step 302, obtaining a message identifier of the internet of things message, where the message identifier includes a first identifier and a second identifier.
The message identifier is a unique identifier for distinguishing message types, and different message identifiers corresponding to different message types are used. The message identification can be a number combination of binary 0 and 1, or a number-letter combination of 16-system 0-F, and the like. The message identifier includes a first identifier and a second identifier, the first identifier is used for representing the protocol type, and the second identifier is used for representing the message type. For example, the representative message identifier Option in the Options in the internet of things message is (9,17,1), where 9 represents a first identifier representing a protocol of an application layer, and 17 represents a second identifier representing a message type based on the application layer protocol.
Step 304, when the first identifier is the preset first identifier, step 306 is executed, and if the first identifier is not the preset first identifier, the process is ended.
The preset first identifier is a preset identifier and is a unique identifier used for distinguishing message types, and different message identifiers corresponding to different message types are used. The message identifier may be a combination of digits of 0 and 1, or 16 digits and/or letters of 0-F.
Step 306, searching for a preset second identifier corresponding to the first identifier from the corresponding relationship between the preset first identifier and the preset second identifier.
The preset second identifier is a preset identifier, and is a unique identifier used for distinguishing message types, and different message identifiers corresponding to different message types. The message identifier may be a combination of digits of 0 and 1, or 16 digits and/or letters of 0-F. The preset first mark corresponds to at least one preset second mark.
In one embodiment, the preset first identifier is 9, and the second identifier corresponding to the preset first identifier includes 00010000, 00010001, 00010010, 00100000, 00100001, 00110000, 00110001, 01000000, 01000001, 01010000, 01010001, 01100000, 01100001, 01110000, and the like.
Step 308, comparing the second identifier with a preset second identifier.
Specifically, the first identifier is a preset first identifier, the preset second identifier is obtained according to a corresponding relationship between the preset first identifier and the preset second identifier, and the analyzed and obtained second identifier is compared with the preset second identifier. And when the preset second identification with the same second identification does not exist, ending, and when the preset second identification with the same second identification exists, determining the message type of the Internet of things according to the second identification.
Step 310, determining a message type of the internet of things message.
Specifically, the message type of the internet of things is determined according to the first identifier and the second identifier. For example, when the first message identifier is 9 and the second message identifier is 00010000, the internet of things message is an observer message; and when the first message identifier is 9 and the second message identifier is 00100000, the message of the internet of things is a Discover message.
In one embodiment, after receiving an internet of things message, a first terminal analyzes the internet of things message through an analysis packet to obtain a message identifier, wherein the message identifier includes a first identifier and a second identifier, when the first identifier in the message identifier is a preset first identifier, a preset second identifier corresponding to the first identifier is searched from a corresponding relationship between the preset first identifier and the preset second identifier according to the first identifier, and when the preset second identifier has a preset second identifier that is the same as the second identifier in the message identifier, a message type corresponding to the preset second identifier is obtained, and the type of the internet of things message is determined.
In the message type judging step of the message of the Internet of things, the message identification of the message of the Internet of things is obtained, wherein the message identification comprises a first identification and a second identification; when the first identification is a preset first identification, searching a preset second identification corresponding to the first identification from the corresponding relation between the preset first identification and the preset second identification, and if the first identification is not the preset first identification, finishing; and comparing the second identification with the preset second identification, determining the type of the message of the Internet of things according to the second identification when the preset second identification with the same second identification exists, and finishing when the preset second identification with the same second identification does not exist. Judging whether the first identification is a preset first identification, finishing judging the message type of the Internet of things when the first identification is not the preset first identification, judging the message type of the Internet of things through the first identification and the second identification, simplifying the judging process of the message type and improving the message type efficiency.
In another embodiment, as shown in fig. 4, a message processing method is provided, which is described by taking the first terminal 102 in fig. 1 as an example, and includes the following steps:
step 402, receiving an internet of things message sent by a second terminal.
And step 404, analyzing the message of the internet of things to obtain a message identifier in the message of the internet of things.
In one embodiment, the internet of things message is a CoaP message, and the CoaP _ GET message in the CoaP message is analyzed through an analysis packet to obtain a message identifier in a message option of the CoaP _ GET message. Step 406, a first identifier and a second identifier of the message identifier are obtained, where the first identifier corresponds to at least one second identifier, the first identifier is used to represent a protocol type, and the second identifier is used to represent a message type.
The first identifier is used for indicating a protocol type, can be a Lightweight protocol (Lightweight M2M, LwM2M), is mainly used for various internet of things devices, belongs to an application layer protocol, and has a structure as shown in fig. 5, a lower layer realizes data transceiving by relying on a limited application protocol, and the limited application protocol can be encrypted through a data packet transmission security protocol and finally transmitted through a user datagram protocol or a short message service. The messages corresponding to the lightweight M2M protocol include: observer, discover, Read, Write, Execute, Parameter, Notify messages. When the protocol is the LwM2M protocol, the first identification may be 9.
And step 408, determining the message type of the message of the internet of things according to the first identifier and the second identifier.
In one embodiment, when the first identifier is 9, that is, the protocol is the LwM2M protocol, the message type corresponding to the LwM2M protocol includes observer, discover, Read, Write, Execute, Parameter, and Notify messages, the second identifier corresponding to each message is different, and the message type of the internet of things message may be determined according to the first identifier and the second identifier.
And step 410, executing corresponding preset operation according to the message type. In the message processing method, the message of the internet of things sent by the second terminal is received; analyzing the message of the Internet of things to obtain a message identifier in the message of the Internet of things, acquiring a first identifier and a second identifier of the message identifier, wherein the first identifier corresponds to at least one second identifier, the first identifier is used for representing a protocol type, the second identifier is used for representing a message type, and the message type of the message of the Internet of things is determined according to the first identifier and the second identifier; when the type of the internet of things message is judged, only the message identification in the internet of things message needs to be analyzed and obtained, the message type of the internet of things message can be determined by simply judging according to the message identification, and further complex judgment on other data carried in the internet of things message is not needed; and executing corresponding preset operation according to the message type, accurately and quickly judging the type of the message of the Internet of things according to the message identifier when receiving a plurality of messages of the Internet of things, and executing the preset operation corresponding to each message type according to the message type, thereby improving the processing efficiency and accuracy of the message of the Internet of things.
In another embodiment, as shown in fig. 6, a message processing method is provided, which is described by taking the application of the method to the second terminal 104 in fig. 1 as an example, and includes the following steps:
step 602, obtaining an internet of things message to be sent.
Step 604, adding a message identifier to the to-be-sent message of the internet of things to obtain the message of the internet of things containing the message identifier, wherein the message identifier is used for determining the message type of the to-be-sent message of the internet of things.
Step 606, sending the internet of things message containing the message identifier to the first terminal.
According to the message processing method, the second terminal obtains the message of the internet of things containing the message identification by obtaining the message of the internet of things to be sent and adding the message identification in the option format to the message option part of the message of the internet of things to be sent, and the message of the internet of things containing the message identification is sent to the first terminal based on a UDP protocol or in an SMS form. By adding the message identifier in the message option of the message of the Internet of things, the message type of the message of the Internet of things can be directly judged according to the message identifier after the message of the Internet of things is analyzed, complex judgment is not needed, and the processing efficiency of the message of the Internet of things is improved.
In one embodiment, the message identifier includes a first identifier and a second identifier, the first identifier being used to indicate a protocol type, and the second identifier being used to identify a message type.
The message type of the message of the internet of things can be judged according to the message identifier in the message acquisition message option after analyzing the message identifier.
It should be understood that although the various steps in the flow charts of fig. 2-6 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least some of the steps in fig. 2-6 may include multiple sub-steps or multiple stages that are not necessarily performed at the same time, but may be performed at different times, and the order of performance of the sub-steps or stages is not necessarily sequential, but may be performed in turn or alternating with other steps or at least some of the sub-steps or stages of other steps.
In one embodiment, as shown in fig. 7, there is provided a message processing apparatus 700, including: a receiving module 702, a parsing module 704, a determining module 706, and an executing module 708, wherein:
a receiving module 702, configured to receive an internet of things message sent by the second terminal.
And the analyzing module 704 is configured to analyze the message of the internet of things to obtain a message identifier in the message of the internet of things.
A determining module 706, configured to determine a message type of the internet of things message according to the message identifier.
An executing module 708, configured to execute a corresponding preset operation according to the message type.
In the message processing device, an internet of things message sent by a second terminal is received; analyzing the message of the Internet of things to obtain a message identifier in the message of the Internet of things, and determining the message type of the message of the Internet of things according to the message identifier; each message identifier corresponds to one message type, when the type of the internet of things message is judged, only the message identifier in the internet of things message needs to be analyzed and obtained, the message type of the internet of things message can be determined by simply judging according to the message identifier, and further complex judgment on other data carried in the internet of things message is not needed; and executing corresponding preset operation according to the message type, accurately and quickly judging the type of the message of the Internet of things according to the message identifier when receiving a plurality of messages of the Internet of things, and executing the preset operation corresponding to each message type according to the message type, thereby improving the processing efficiency and accuracy of the message of the Internet of things.
In an embodiment, the message processing apparatus 700 further includes an obtaining module 710, where:
the obtaining module 710 is configured to obtain a first identifier and a second identifier of a message identifier, where the first identifier corresponds to at least one second identifier, the first identifier is used to indicate a protocol type, and the second identifier is used to indicate a message type.
In one embodiment, the message processing apparatus 700 further comprises a searching module 712 and a determining module 714, wherein:
the searching module 712 is configured to search for a preset second identifier corresponding to the first identifier from a corresponding relationship between the preset first identifier and the preset second identifier.
A judging module 714, configured to compare the second identifier with a preset second identifier; and when the second identifier is the same as the preset second identifier, determining the message type of the message of the Internet of things.
In another embodiment, as shown in fig. 8, there is provided a message processing apparatus 800 including: an obtaining module 802, a constructing module 804, and a sending module 806, wherein:
an obtaining module 802, configured to obtain an internet of things message to be sent.
An adding module 804, configured to add a message identifier to an internet of things message to be sent, so as to obtain an internet of things message including the message identifier; the message identifier is used for determining the message type of the internet of things message to be sent.
A sending module 806, configured to send the internet of things message including the message identifier to the first terminal.
In the message processing device, the second terminal acquires the to-be-sent internet of things message, adds the message identifier in the option format to the message option part of the to-be-sent internet of things message to obtain the internet of things message containing the message identifier, and sends the internet of things message containing the message identifier to the first terminal based on a UDP protocol or in an SMS form. By adding the message identifier in the message option of the message of the Internet of things, the message type of the message of the Internet of things can be directly judged according to the message identifier after the message of the Internet of things is analyzed, complex judgment is not needed, and the processing efficiency of the message of the Internet of things is improved.
For the specific definition of the message processing device, reference may be made to the above definition of the message processing method, which is not described herein again. The respective modules in the message processing apparatus described above may be implemented in whole or in part by software, hardware, and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as shown in fig. 9. The computer device includes a processor, a memory, a network interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a message processing method. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, a key, a track ball or a touch pad arranged on the shell of the computer equipment, an external keyboard, a touch pad or a mouse and the like.
Those skilled in the art will appreciate that the architecture shown in fig. 9 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is provided, comprising a memory and a processor, the memory having a computer program stored therein, the processor implementing the following steps when executing the computer program:
receiving an Internet of things message sent by a second terminal;
analyzing the message of the Internet of things to obtain a message identifier in the message of the Internet of things;
determining the message type of the message of the Internet of things according to the message identifier;
and executing corresponding preset operation according to the message type.
In one embodiment, the processor, when executing the computer program, further implements the following:
the internet of things message is a user datagram protocol based internet of things message.
In one embodiment, the processor, when executing the computer program, further implements the following:
the internet of things message based on the user datagram protocol comprises a CoaP message.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
determining the message type of the message of the Internet of things according to the message identifier, wherein the message type comprises the following steps:
acquiring a first identifier and a second identifier of a message identifier, wherein the first identifier corresponds to at least one second identifier, the first identifier is used for representing a protocol type, and the second identifier is used for representing a message type;
and determining the message type of the message of the Internet of things according to the first identifier and the second identifier.
In one embodiment, the processor, when executing the computer program, further performs the steps of:
the first identification is a preset first identification; determining the message type of the message of the internet of things according to the first identifier and the second identifier, wherein the message type comprises the following steps:
searching a preset second identifier corresponding to the first identifier from the corresponding relation between the preset first identifier and the preset second identifier;
comparing the second identification with a preset second identification;
and when the second identifier is the same as the preset second identifier, determining the message type of the message of the Internet of things.
In one embodiment, a computer-readable storage medium is provided, having a computer program stored thereon, which when executed by a processor, performs the steps of:
receiving an Internet of things message sent by a second terminal;
analyzing the message of the Internet of things to obtain a message identifier in the message of the Internet of things;
determining the message type of the message of the Internet of things according to the message identifier;
and executing corresponding preset operation according to the message type.
In one embodiment, the computer program when executed by the processor further implements the following:
the internet of things message is a user datagram protocol based internet of things message.
In one embodiment, the computer program when executed by the processor further implements the following:
the internet of things message based on the user datagram protocol comprises a CoaP message.
In one embodiment, the computer program when executed by the processor further performs the steps of:
determining the message type of the message of the Internet of things according to the message identifier, wherein the message type comprises the following steps:
acquiring a first identifier and a second identifier of a message identifier, wherein the first identifier corresponds to at least one second identifier, the first identifier is used for representing a protocol type, and the second identifier is used for representing a message type;
and determining the message type of the message of the Internet of things according to the first identifier and the second identifier.
In one embodiment, the computer program when executed by the processor further performs the steps of:
the first identification is a preset first identification; determining the message type of the message of the internet of things according to the first identifier and the second identifier, wherein the message type comprises the following steps:
searching a preset second identifier corresponding to the first identifier from the corresponding relation between the preset first identifier and the preset second identifier;
comparing the second identification with a preset second identification;
and when the second identifier is the same as the preset second identifier, determining the message type of the message of the Internet of things.
In one embodiment, a computer device is provided, comprising a memory and a processor, the memory having a computer program stored therein, the processor implementing the following steps when executing the computer program:
acquiring an Internet of things message to be sent;
adding a message identifier in an Internet of things message to be sent to obtain the Internet of things message containing the message identifier; the message identifier is used for determining the message type of the internet of things message to be sent;
and sending the message of the Internet of things containing the message identifier to the first terminal.
In one embodiment, the processor, when executing the computer program, further implements the following:
the message identifier comprises a first identifier and a second identifier, wherein the first identifier is used for indicating the protocol type, and the second identifier is used for indicating the message type.
In one embodiment, a computer-readable storage medium is provided, having a computer program stored thereon, which when executed by a processor, performs the steps of:
acquiring an Internet of things message to be sent;
adding a message identifier in an Internet of things message to be sent to obtain the Internet of things message containing the message identifier; the message identifier is used for determining the message type of the internet of things message to be sent;
and sending the message of the Internet of things containing the message identifier to the first terminal.
In one embodiment, the computer program when executed by the processor further implements the following:
the message identifier comprises a first identifier and a second identifier, wherein the first identifier is used for indicating the protocol type, and the second identifier is used for indicating the message type.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (11)

1. A message processing method applied to a first terminal, the method comprising:
receiving an Internet of things message sent by a second terminal;
analyzing the message of the Internet of things to obtain a message identifier in the message of the Internet of things;
determining the message type of the message of the Internet of things according to the message identifier;
and executing corresponding preset operation according to the message type.
2. The method of claim 1, wherein the internet of things message is a user datagram protocol based internet of things message.
3. The method of claim 2, wherein the user datagram protocol based internet of things message comprises a CoaP message.
4. The method of claim 1, wherein the determining the message type of the internet of things message according to the message identifier comprises:
acquiring a first identifier and a second identifier of the message identifier, wherein the first identifier corresponds to at least one second identifier, the first identifier is used for representing a protocol type, and the second identifier is used for representing a message type;
and determining the message type of the message of the Internet of things according to the first identifier and the second identifier.
5. The method of claim 4, wherein the first identifier is a preset first identifier;
the determining the message type of the internet of things message according to the first identifier and the second identifier includes:
searching a preset second identifier corresponding to a first identifier from a corresponding relation between the preset first identifier and the preset second identifier;
comparing the second identifier with the preset second identifier;
and when the second identifier is the same as the preset second identifier, determining the message type of the message of the Internet of things.
6. A message processing method, applied to a second terminal, the method comprising:
acquiring an Internet of things message to be sent;
adding a message identifier in the to-be-sent Internet of things message to obtain the Internet of things message containing the message identifier; the message identifier is used for determining the message type of the to-be-sent internet of things message;
and sending the message of the Internet of things containing the message identifier to the first terminal.
7. The method of claim 6, wherein the message identifier comprises a first identifier and a second identifier, the first identifier is used for indicating a protocol type, and the second identifier is used for indicating a message type.
8. A message processing apparatus, characterized in that the apparatus comprises:
the receiving module is used for receiving the Internet of things message sent by the second terminal;
the analysis module is used for analyzing the message of the Internet of things to obtain a message identifier in the message of the Internet of things;
the determining module is used for determining the message type of the message of the Internet of things according to the message identifier;
and the execution module is used for executing corresponding preset operation according to the message type.
9. A message processing apparatus, characterized in that the apparatus comprises:
the acquisition module is used for acquiring the message of the Internet of things to be sent;
the adding module is used for adding a message identifier into the to-be-sent Internet of things message to obtain the Internet of things message containing the message identifier; the message identifier is used for determining the message type of the to-be-sent internet of things message; and the sending module is used for sending the message of the internet of things containing the message identifier to the first terminal.
10. A computer device comprising a memory and a processor, the memory storing a computer program, wherein the processor implements the steps of the method of any one of claims 1 to 7 when executing the computer program.
11. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 7.
CN201910911094.0A 2019-09-25 2019-09-25 Message processing method, device, computer equipment and storage medium Active CN110808950B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910911094.0A CN110808950B (en) 2019-09-25 2019-09-25 Message processing method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910911094.0A CN110808950B (en) 2019-09-25 2019-09-25 Message processing method, device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN110808950A true CN110808950A (en) 2020-02-18
CN110808950B CN110808950B (en) 2022-06-28

Family

ID=69487869

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910911094.0A Active CN110808950B (en) 2019-09-25 2019-09-25 Message processing method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN110808950B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112468485A (en) * 2020-11-24 2021-03-09 广东电力信息科技有限公司 Internet of things message processing method, device, terminal and storage medium
CN114979308A (en) * 2022-05-11 2022-08-30 北京沃东天骏信息技术有限公司 Message processing method and device
CN115633187A (en) * 2022-12-22 2023-01-20 易方信息科技股份有限公司 Chat message processing method and device, computer equipment and storage medium

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2012167659A1 (en) * 2011-07-14 2012-12-13 华为技术有限公司 Data communication method and device in constrained application protocol
CN103795689A (en) * 2012-10-29 2014-05-14 中兴通讯股份有限公司 Resource subscription method and device
CN105075224A (en) * 2013-02-08 2015-11-18 交互数字专利控股公司 Method and apparatus for incorporating an internet of things (IoT) service interface protocol layer in a node
US20150339131A1 (en) * 2012-10-29 2015-11-26 Zte Corporation Method and device for deregistering terminal peripheral in machine type communication system, and gateway
CN106209812A (en) * 2016-07-04 2016-12-07 深圳市得润车联科技有限公司 A kind of method of internet-of-things terminal platform data encapsulation
CN107070719A (en) * 2017-04-24 2017-08-18 紫光华山信息技术有限公司 A kind of device management method and device
KR20190064346A (en) * 2017-11-30 2019-06-10 동국대학교 산학협력단 System for transmitting push message
CN109996304A (en) * 2018-01-02 2019-07-09 ***通信有限公司研究院 A kind of Internet of Things method for switching network and device
CN110113730A (en) * 2019-03-22 2019-08-09 深圳市广和通无线股份有限公司 Method for network access, device, Internet of Things module and storage medium

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2012167659A1 (en) * 2011-07-14 2012-12-13 华为技术有限公司 Data communication method and device in constrained application protocol
CN103795689A (en) * 2012-10-29 2014-05-14 中兴通讯股份有限公司 Resource subscription method and device
US20150339131A1 (en) * 2012-10-29 2015-11-26 Zte Corporation Method and device for deregistering terminal peripheral in machine type communication system, and gateway
CN105075224A (en) * 2013-02-08 2015-11-18 交互数字专利控股公司 Method and apparatus for incorporating an internet of things (IoT) service interface protocol layer in a node
CN106209812A (en) * 2016-07-04 2016-12-07 深圳市得润车联科技有限公司 A kind of method of internet-of-things terminal platform data encapsulation
CN107070719A (en) * 2017-04-24 2017-08-18 紫光华山信息技术有限公司 A kind of device management method and device
KR20190064346A (en) * 2017-11-30 2019-06-10 동국대학교 산학협력단 System for transmitting push message
CN109996304A (en) * 2018-01-02 2019-07-09 ***通信有限公司研究院 A kind of Internet of Things method for switching network and device
CN110113730A (en) * 2019-03-22 2019-08-09 深圳市广和通无线股份有限公司 Method for network access, device, Internet of Things module and storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
PEI-YIH TING、JIA-LUN TSAI、TZONG-SUN WU: ""Signcryption Method Suitable for Low-Power IoT Devices in a Wireless Sensor Network"", 《IEEE SYSTEMS JOURNAL》 *
刘峰、陈朴、贾军营: ""WebSocket与MQTT在Web即时通信***中的应用"", 《计算机***应用》 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112468485A (en) * 2020-11-24 2021-03-09 广东电力信息科技有限公司 Internet of things message processing method, device, terminal and storage medium
CN114979308A (en) * 2022-05-11 2022-08-30 北京沃东天骏信息技术有限公司 Message processing method and device
CN114979308B (en) * 2022-05-11 2024-04-16 北京沃东天骏信息技术有限公司 Message processing method and device
CN115633187A (en) * 2022-12-22 2023-01-20 易方信息科技股份有限公司 Chat message processing method and device, computer equipment and storage medium

Also Published As

Publication number Publication date
CN110808950B (en) 2022-06-28

Similar Documents

Publication Publication Date Title
CN107612909B (en) Information interaction method, device and equipment about Internet of things equipment
CN110808950B (en) Message processing method, device, computer equipment and storage medium
CN107665233B (en) Database data processing method and device, computer equipment and storage medium
CN107870860B (en) Buried point verification system and method
CN109787974B (en) Message data stream generation method and device, computer equipment and storage medium
CN106878108B (en) Network flow playback test method and device
CN109547363B (en) Data transmission method, device, computer equipment and storage medium
CN110891005A (en) IOT equipment control method, cloud server and IOT equipment control system
CN108418797B (en) Webpage access method and device, computer equipment and storage medium
CN111683066A (en) Heterogeneous system integration method and device, computer equipment and storage medium
CN112686358A (en) Data transmission method, NFC electronic tag, terminal device and storage medium
CN111737527A (en) Data processing method and device for heterogeneous terminal, electronic equipment and storage medium
CN112631924A (en) Automatic testing method and device, computer equipment and storage medium
CN108897728B (en) Short message splicing processing method and device, computer equipment and storage medium
Fan et al. Secure ultra-lightweight RFID mutual authentication protocol based on transparent computing for IoV
CN111552696A (en) Data processing method and device based on big data, computer equipment and medium
CN112866348A (en) Database access method and device, computer equipment and storage medium
CN108833500B (en) Service calling method, service providing method, data transmission method and server
CN111147586B (en) Equipment end control method and device and conference system
CN113037820A (en) Thing networking device communication module
US20190129907A1 (en) Data transfer system, data transfer apparatus, data transfer method, and computer-readable recording medium
CN111131465B (en) Internet of things data processing method and device based on block chain and server
CN110930193B (en) Advertisement conversion rate evaluation method, advertisement conversion rate evaluation device, computer equipment and storage medium
CN114338527B (en) IPv6 active identifier processing method and system
CN112464259B (en) ERP page acquisition method, ERP page acquisition device, computer equipment and storage medium

Legal Events

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