WO2016197995A1 - Method and device for realizing stateful operation in stateless network protocol - Google Patents

Method and device for realizing stateful operation in stateless network protocol Download PDF

Info

Publication number
WO2016197995A1
WO2016197995A1 PCT/CN2016/085873 CN2016085873W WO2016197995A1 WO 2016197995 A1 WO2016197995 A1 WO 2016197995A1 CN 2016085873 W CN2016085873 W CN 2016085873W WO 2016197995 A1 WO2016197995 A1 WO 2016197995A1
Authority
WO
WIPO (PCT)
Prior art keywords
session
internet
things
logical
platform
Prior art date
Application number
PCT/CN2016/085873
Other languages
French (fr)
Chinese (zh)
Inventor
李伟华
Original Assignee
中兴通讯股份有限公司
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 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2016197995A1 publication Critical patent/WO2016197995A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L65/00Network arrangements, protocols or services for supporting real-time applications in data packet communication
    • H04L65/40Support for services or applications
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/141Setup of application sessions
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/142Managing session states for stateless protocols; Signalling session states; State transitions; Keeping-state mechanisms
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/146Markers for unambiguous identification of a particular session, e.g. session cookie or URL-encoding

Definitions

  • the present application relates to, but is not limited to, the field of Internet of Things technologies, and in particular, to a method and apparatus for implementing stateful operation in a stateless network protocol.
  • a resource can be defined as a directly accessible, independently developed, deployable, manageable, and maintainable software component that supports specific data.
  • the Resource-Oriented Architecture is a software architecture based on the Representational State Transfer (REST) style of the Internet of Things.
  • the resources in the IoT environment can be a terminal device or a terminal device.
  • data exchange is resource-centric operation. Resources have a common operation mode, namely REST mode.
  • REST design contains several basic characteristics, one of which is basic statelessness (Statelessness), that is, each pair Resource requests (such as HTTP requests) are isolated and do not depend on their previous or subsequent requests.
  • Statelessness basic statelessness
  • the query command needs to modify the settings of the terminal device, and the terminal device performs a certain setting operation according to the query instruction of the application terminal before performing the query operation.
  • the application terminal restores the terminal device to the original setting.
  • the application terminal that is undergoing interaction needs to establish a complete session process with the terminal device, that is, setting --> query --> recovery, and needs to be serially completed in a session process.
  • WMMP Wireless Machine to Machine Protocol
  • Request packet subcontracting That is, in a session of a WMMP communication process, the requester has a data request packet to be transmitted, and after receiving the request, the responder returns a response packet whose packet size exceeds the maximum length of the packet body. At this point, the responder will send the response to the requester in the form of multiple packets, and the requester will send a new request after receiving each packet to request the next packet until the last one is received. Subcontracting.
  • the response packet is subcontracted. That is, in a session of a WMMP communication process, the requester's request packet data packet size exceeds the maximum length of the packet body. At this time, the requester sends a data packet to the responder in a multi-packet manner. After receiving the packet, the responder returns the packet response, and the requester receives the packet response and then sends the next packet until the last packet is received; The response packet generated by the responder after receiving all the packets and processing is smaller than the maximum length of the packet body, and the response packet is returned at this time.
  • the server is connected to the sending client and the receiving client based on the stateless network protocol, and at least two session nodes are established in the connection state table of the simulated connection layer of the server, and the session node corresponds to the two clients; the sending client sends the request message.
  • the request information includes the exchange data to be sent to the receiving client; the server temporarily stores the exchange data to the session node corresponding to the receiving client; the receiving client sends the request message to the server, and the server determines to send the session node corresponding to the client.
  • the temporary exchange data is obtained from the session node determined in the connection state table of the simulation connection layer, and the communication data is carried in the reply information. It can solve stateless operations in stateless network protocol connections. However, if multiple clients send messages to the same receiving client, or multiple clients send exclusive resources to the same receiving client, for example, performing an exclusive query operation, the scenario cannot be resolved.
  • the "Internet of Things” that is, information sensing devices such as radio frequency identification (RFID), infrared sensors, global positioning systems, laser scanners, etc., connect any items to the Internet according to a contractual agreement, and carry out information. Exchange and communication to enable intelligent identification, location, tracking, monitoring and management of the network.
  • RFID radio frequency identification
  • infrared sensors such as infrared sensors
  • global positioning systems such as global positioning systems, laser scanners, etc.
  • the Internet of Things architecture can be divided into three levels: the perception layer, the network layer, and the application layer.
  • the sensing layer mainly includes two-dimensional code labels and readers, RFID tags and readers, cameras, global positioning systems, sensors, sensor networks and sensor gateways.
  • the sensing layer mainly realizes sensing, recognizing objects, collecting and capturing information.
  • the network layer first includes an access layer and a transport layer, such as a converged network formed by various communication networks and the Internet; and also includes various common platforms, such as an Internet of Things capability open platform, an Internet of Things management platform, and an Internet of Things information center, and a cloud. Computing platform, expert system, etc., for management and intelligent analysis of massive information.
  • a transport layer such as a converged network formed by various communication networks and the Internet
  • various common platforms such as an Internet of Things capability open platform, an Internet of Things management platform, and an Internet of Things information center, and a cloud.
  • Computing platform, expert system, etc. for management and intelligent analysis of massive information.
  • the application layer is a combination of IoT technology and industry expertise to achieve a wide range of intelligent application solutions.
  • Embodiments of the present invention provide a method and apparatus for implementing stateful operation in a stateless network protocol, which are intended to solve the problem in the related art that when a session is delivered, the session must remain intact, the session packet is lost, and the sender is resent and multiple senders are lost.
  • the problem that the message cannot be operated when sending a message to the same receiving end enables the IoT application to perform stateful operations on the IoT terminal in the stateless network.
  • An embodiment of the present invention provides a method for implementing a stateful operation in a stateless network protocol, which is applied to an Internet of Things platform, and the method includes:
  • first session instruction initiated by the Internet of Things application, where the first session instruction is a logical session instruction including a first physical session identifier;
  • a platform logical session node that resolves the first session instruction and creates a parsed first session instruction, and stores the platform logical session node according to the priority to a platform corresponding to the IoT terminal identifier carried by the first session instruction In the conversation list;
  • the logical session establishment success message carrying the logical session identifier to the Internet of Things terminal, so that the Internet of Things application and the Internet of Things terminal complete the delivery of the message through the logical session identifier.
  • the step of establishing a session connection between the Internet of Things terminals corresponding to the IoT terminal identifier carried by the first session instruction includes:
  • the first physical session identifier is obtained
  • the step of parsing the first session instruction further includes: acquiring an IoT terminal identifier and a session attribute carried in the first session instruction.
  • the platform logical session node that creates the parsed first session instruction after parsing the first session instruction includes:
  • a node is added to the list of the Internet of Things terminals to store the first node address of the platform session linked list corresponding to the current Internet of Things terminal, and the platform logical session node is created;
  • the corresponding session session list is searched according to the priority of the first node address of the platform session list included in the current IoT terminal node, and the parsed first session instruction is placed at the end of the session of the same priority.
  • the method further includes: if the current IoT terminal has a session, and the session attribute is the shared mode, the first session instruction is parsed into a session with the same priority and the same resource identifier.
  • the method further includes:
  • a session termination success message carrying the logical session identifier, and deleting, by the IoT application, an application logical session node generated when the first session instruction is initiated, and terminating the session.
  • the embodiment of the present invention further provides a method for implementing a stateful operation in a stateless network protocol, which is applied to an Internet of Things application, and the method includes:
  • a logical session establishment success message including the logical session identifier sent by the Internet of Things platform after establishing a session connection with the Internet of Things terminal and generating a logical session identifier, parsing and obtaining the logical session identifier, and saving, to the object
  • the networking platform feeds back the connection success message.
  • the first session instruction carries an Internet of Things terminal identifier and a session attribute.
  • the method further includes: generating an application logical session node.
  • the method further includes:
  • the termination session instruction is sent by the IoT platform to the Internet of Things terminal, and receiving the IoT terminal is deleted and The session termination success message returned after the terminal logical session node is generated when the Internet of Things platform establishes a session connection;
  • the embodiment of the present invention further provides a method for implementing a stateful operation in a stateless network protocol, which is applied to an Internet of Things terminal, and the method includes:
  • the method further includes: generating a terminal logical session node; extracting the session attribute carried in the second session instruction, and saving.
  • the method further includes:
  • the embodiment of the present invention further provides a device for implementing stateful operation in a stateless network protocol, which is applied to an Internet of Things platform, and the device includes:
  • a first receiving module configured to receive a first session instruction initiated by the Internet of Things application, where the first session instruction is a logical session instruction including a first physical session identifier;
  • a processing processing module is configured to: after parsing the first session instruction, create a platform logical session node of the parsed first session instruction, and store the platform logical session node according to the priority The platform session list corresponding to the IoT terminal identifier carried by the first session instruction;
  • Establishing a generation module configured to establish a session connection between the Internet of Things terminals corresponding to the IoT terminal identifier carried by the first session instruction, and generate logic for performing a logical session between the Internet of Things application and the Internet of Things terminal Session identifier
  • a first returning module configured to return a logical session establishment success message carrying the logical session identifier to the Internet of Things application and the Internet of Things terminal, to enable the Internet of Things application and the Internet of Things terminal to pass the logical session Identifies the delivery of the completion message.
  • the establishing the generating module includes:
  • a sending submodule configured to send a second session instruction to the Internet of Things terminal
  • the first receiving submodule is configured to receive a session establishment message returned after the IoT terminal receives the second session instruction to generate a logical session node of the terminal.
  • the establishing the generating module includes:
  • a second receiving sub-module configured to establish a session connection with the Internet of Things terminal, and receive a second physical session identifier returned by the Internet of Things terminal;
  • Generating a submodule configured to generate the logical session identifier according to the first physical session identifier and the second physical session identifier.
  • the creation processing module is further configured to: acquire an IoT terminal identifier and a session attribute carried in the first session instruction.
  • the creation processing module includes:
  • a locating sub-module configured to search, in the IoT terminal list, whether the current IoT terminal corresponding to the IoT terminal identifier has a session according to the IoT terminal identifier carried in the first session instruction;
  • the processing submodule is configured to: if the current IoT terminal does not have a session, add a node in the IoT terminal list to store the first node address of the platform session linked list corresponding to the current IoT terminal, and create the platform logic Session node; if there is a session in the current IoT terminal, according to The first node address of the platform session list included in the previous IoT terminal node searches the corresponding platform session list according to the priority, and places the parsed first session instruction at the end of the session of the same priority.
  • the processing sub-module is further configured to: if the current IoT terminal has a session, and the session attribute is the shared mode, the first session instruction is parsed into a session with the same priority and the same resource identifier.
  • the device further comprises:
  • a second receiving module configured to receive a termination session command that is sent by the Internet of Things application and that carries the logical session identifier
  • a first sending module configured to send the termination session instruction to the Internet of Things terminal, and delete, by the IoT terminal, a terminal logical session node generated when establishing a session connection with the Internet of Things platform;
  • a third receiving module configured to receive a session termination success message sent by the Internet of Things terminal that carries the logical session identifier, and delete the platform logical session node;
  • a second returning module configured to return a session termination success message carrying the logical session identifier to the Internet of Things application, where the application logical session node generated when the first session instruction is initiated is deleted by the Internet of Things application, Terminate the session.
  • the embodiment of the present invention further provides a device for implementing stateful operation in a stateless network protocol, which is applied to an Internet of Things application, and the device includes:
  • the initiating module is configured to initiate a first session instruction including the first physical session identifier to the Internet of Things platform, where the first session instruction received by the Internet of Things platform is parsed and the parsed first session instruction is created After the platform logical session node, establish a session connection with the Internet of Things terminal;
  • a processing module configured to receive a logical session establishment success message including the logical session identifier sent after the IoT platform establishes a session connection with the Internet of Things terminal, and generates a logical session identifier, and obtains the logical session identifier and saves And feeding back the connection success message to the Internet of Things platform.
  • the first session instruction carries an Internet of Things terminal identifier and a session attribute.
  • the initiating module is further configured to: generate an application logical session node.
  • the device further comprises:
  • a second sending module configured to send a termination session instruction carrying the logical session identifier to the Internet of Things platform, where the termination session command is sent by the Internet of Things platform to the Internet of Things terminal, and the receiving Determining a session termination success message returned by the Internet of Things terminal after deleting the terminal logical session node generated when the session connection is established with the Internet of Things platform;
  • the first receiving processing module is configured to receive the session termination success message forwarded by the IoT platform after deleting the platform logical session node, delete the application logical session node, and terminate the session.
  • the embodiment of the present invention further provides a device for implementing stateful operation in a stateless network protocol, which is applied to an Internet of Things terminal, and the device includes:
  • a fourth receiving module configured to receive a second session instruction sent by the Internet of Things platform, where the second session instruction creates a platform logical session node for the IoT platform and acquires a first physical session with the Internet of Things application Sent after the identification;
  • Establishing a return module configured to establish a session connection with the Internet of Things platform, and return a session establishment message to the Internet of Things platform, wherein the Internet of Things application and the Internet of Things terminal are generated by the Internet of Things platform a logical session identifier between logical sessions;
  • the second receiving processing module is configured to receive a logical session establishment success message that is sent by the Internet of Things platform and that carries the logical session identifier, and complete the delivery of the message according to the logical session identifier and the Internet of Things application.
  • the fourth receiving module is further configured to: generate a logical session node of the terminal, extract the session attribute carried in the second session instruction, and save the session attribute.
  • the device further comprises:
  • a fifth receiving module configured to receive, by the IoT application, a termination session instruction that is sent by the Internet of Things platform and that carries the logical session identifier;
  • Deleting a module, configured to delete the terminal logical session node according to the terminating session instruction
  • a third sending module configured to send a session termination success message carrying the logical session identifier to the Internet of Things platform, where the IoT platform deletes the platform logical session node and returns to the Internet of Things application a session termination success message identified by the logical session, by the The IoT application deletes the application logical session node and terminates the session.
  • Embodiments of the present invention further provide a computer readable storage medium storing computer executable instructions that, when executed, implement a method for implementing stateful operations in the above stateless network protocol applied to an Internet of Things platform.
  • Embodiments of the present invention also provide a computer readable storage medium storing computer executable instructions that, when executed, implement a method for implementing stateful operations in the above stateless network protocol applied to an Internet of Things application.
  • Embodiments of the present invention further provide a computer readable storage medium storing computer executable instructions, which when implemented, implement a method for implementing stateful operations in the above stateless network protocol applied to an Internet of Things terminal.
  • the embodiment of the present invention initiates a logical session instruction through the Internet of Things application, and after the Internet of Things platform parses the logical session instruction, creates a platform logical session node for storage; establishes a session connection with the corresponding IoT terminal, and generates a logical session identifier;
  • the Internet of Things application and the Internet of Things terminal send a logical session establishment success message carrying the logical session identifier to form a message transmission between the Internet of Things application and the Internet of Things terminal, which can solve the problem that the session must be kept intact and the session packet is lost when the session is delivered in the related art.
  • the IoT application can perform stateful operations on the IoT terminal in the stateless network.
  • FIG. 1 is a first schematic diagram of a method for implementing stateful operation in a stateless network protocol according to an embodiment of the present invention
  • FIG. 2 is a schematic diagram of a list of an Internet of Things terminal according to an embodiment of the present invention.
  • FIG. 3 is a second schematic diagram of a method for implementing stateful operation in a stateless network protocol according to an embodiment of the present invention
  • FIG. 4 is a third schematic diagram of a method for implementing stateful operation in a stateless network protocol according to an embodiment of the present invention
  • FIG. 5 is a schematic flowchart of an overall process of establishing a logical session according to an embodiment of the present invention
  • FIG. 6 is a schematic diagram of a message delivery process according to an embodiment of the present invention.
  • FIG. 7 is a schematic flowchart of a termination logical session according to an embodiment of the present invention.
  • FIG. 8 is a first schematic diagram of an apparatus for implementing stateful operation in a stateless network protocol according to an embodiment of the present invention
  • FIG. 9 is a second schematic diagram of an apparatus for implementing stateful operation in a stateless network protocol according to an embodiment of the present invention.
  • FIG. 10 is a third schematic diagram of an apparatus for implementing stateful operation in a stateless network protocol according to an embodiment of the present invention.
  • the Internet of Things terminal, the Internet of Things platform, and the Internet of Things application respectively represent the sensing layer, the network layer, and the application layer.
  • An embodiment of the present invention provides a method for implementing stateful operation in a stateless network protocol, which is applied to an Internet of Things platform. As shown in FIG. 1 , the method includes the following steps:
  • Step S101 Receive a first session instruction initiated by an Internet of Things application, where the first session instruction is a logical session instruction including a first physical session identifier;
  • Step S102 After the first session instruction is parsed, the platform logical session node of the parsed first session instruction is created, and the platform logical session node is stored according to the priority to the IoT terminal identifier carried by the first session instruction. Corresponding platform session list;
  • Step S103 Establish a session connection between the Internet of Things terminals corresponding to the IoT terminal identifier carried by the first session instruction, and generate a logical session identifier for performing a logical session between the Internet of Things application and the Internet of Things terminal;
  • Step S104 Returning, to the Internet of Things application, the logical session establishment success message carrying the logical session identifier to the Internet of Things terminal, so that the Internet of Things application and the Internet of Things terminal complete the message through the logical session identifier transfer.
  • the communication between the Internet of Things application and the Internet of Things terminal can be completed through the logical session identification, so that the Internet of Things application can perform stateful operations on the Internet of Things terminal in the stateless network.
  • the Internet of Things platform is a relatively broad concept.
  • the Internet of Things platform can be composed of one or more devices, such as the Internet of Things capability open platform, the Internet of Things management platform, and the Internet of Things information center.
  • the IoT platform receives the first session instruction that is sent by the IoT application and includes the first physical session identifier, and the first session instruction is substantially a logical session instruction.
  • the logical session includes multiple network layer/transport layer end-to-end connections, which is different from the Open System Interconnect (OSI) model layer 5 session layer.
  • the OSI session layer is mainly two sessions.
  • the management service of the dialog connection provided by the layer entity for the session, the OSI session layer relies on the end-to-end connection of the network layer/transport layer.
  • a logical session can contain multiple OSI session layers.
  • the session created when the session created when user A and server S are connected to terminal device D and server S is two different sessions.
  • user A is required to establish an end-to-end session with terminal device D.
  • This session will contain sessions between user A and server S and terminal device D and server S.
  • a session including multiple sessions is referred to as a logical session, and a general session included in a logical session is referred to as a physical session.
  • the Internet of Things platform After receiving the first session instruction, the Internet of Things platform parses the first session instruction, and then creates a platform logical session node of the parsed first session instruction, each platform logical session node represents a session, and the platform logical session node includes the session Attributes, priorities, etc. It should be noted that the platform logical session node is a logical session node created by the Internet of Things platform, and the platform logical session node is created and stored in the corresponding platform session list.
  • the platform session list is composed of one or more platform logical session nodes, and each IoT terminal uniquely corresponds to a platform session list. After the IoT platform creates a platform logical session node representing the session, the IoT terminal identifies the IoT terminal. Corresponding platform session list, and through the first node address of the platform session list, the created platform logical session node is placed in the appropriate position of the platform session list according to the priority.
  • the first node of each platform session list contains two data linked lists: instruction message list and response Interest list.
  • the instruction message linked list stores one or more messages sent by the Internet of Things application to the Internet of Things terminal
  • the response message linked list stores the message sent by the IoT terminal to one or more IoT applications
  • the response message also establishes the Internet of Things according to the IoT application identifier.
  • Applying the corresponding linked list the Internet of Things platform quickly queries the pending data corresponding to the Internet of Things application according to the IoT application linked list, and the response message linked list is mainly used for reporting the information of the Internet of Things terminal.
  • a logical session identifier is generated, so that a logical session can be performed between the Internet of Things application and the IoT terminal. Then, the Internet of Things platform returns a logical session establishment success message carrying the logical session identifier to the Internet of Things application and the Internet of Things terminal, and completes the delivery of the message between the Internet of Things application and the Internet of Things terminal.
  • step S103 establishing a session connection between the Internet of Things terminals corresponding to the identifier of the Internet of Things terminal carried by the first session instruction includes:
  • the IoT platform receives the first session instruction and parses the first session instruction, creates a platform logical session node of the first session instruction after parsing, and stores the platform logical session node according to the priority to the object carried by the first session instruction.
  • the second session instruction is sent to the Internet of Things terminal corresponding to the IoT terminal identifier carried by the first session instruction, so that the Internet of Things terminal generates the terminal logic after receiving the second session instruction.
  • the session node returns a session establishment message to the Internet of Things platform, and the Internet of Things platform completes the session connection with the Internet of Things terminal after receiving the session establishment message returned by the Internet of Things terminal.
  • step S103 generating a logical session identifier for performing a logical session between the Internet of Things application and the Internet of Things terminal, including:
  • the first physical session identifier is obtained
  • the IoT platform obtains the first physical session identifier between the IoT application and the IoT application after the first session instruction is parsed and the platform logical session node of the first session instruction is parsed. After establishing the session connection with the Internet of Things terminal, the Internet of Things platform receives the second physical session identifier returned by the Internet of Things terminal. And generating a logical session identifier by using a hash function according to the first physical session identifier and the second physical session identifier sent by the Internet of Things terminal.
  • the first physical session identifier is stored in the first session instruction, and after the Internet of Things platform parses the first session instruction and creates a platform logical session node of the first session instruction after parsing, acquiring the application with the Internet of Things a first physical session identifier; when the Internet of Things platform sends a second session instruction to the Internet of Things terminal, and after receiving the second session instruction by the Internet of Things terminal, generating a terminal logical session node and returning a second physics with the Internet of Things platform Session ID.
  • step of parsing the first session instruction in step S102 further includes:
  • the IoT platform acquires the IoT terminal identifier and the session attribute carried in the first session instruction when parsing the first session instruction.
  • Session attributes include: shared or exclusive, if it is exclusive access, set the lock mechanism, and queue access requests. This ensures that in the IoT environment, multiple IoT applications will not cause illegal access when accessing the same IoT terminal.
  • the platform logical session node that parses the first session instruction after parsing the first session instruction includes:
  • a node is added to the list of the Internet of Things terminals to store the first node address of the platform session linked list corresponding to the current Internet of Things terminal, and the platform logical session node is created;
  • the corresponding platform session list is searched according to the priority, and the first session refers to the parsed Order the session at the same level as the priority.
  • the Internet of Things terminal list is organized by the Internet of Things terminal, and the list node includes the IoT terminal identifier and the first node address of the corresponding platform session linked list.
  • the identifier of the Internet of Things terminal is obtained, and according to the identifier of the Internet of Things terminal, the Internet of Things terminal list is searched for whether the current Internet of Things terminal corresponding to the IoT terminal identifier already has a session. If there is no session in the current IoT terminal, a node is added to the IoT terminal list to store the first node address of the platform session list corresponding to the current IoT terminal, and the save is created in the corresponding platform session list.
  • the corresponding platform session list is searched according to the priority according to the first node address of the platform session list included in the current IoT terminal node, and the parsed first session instruction is placed at the end of the session of the same priority.
  • the session attribute in the first session instruction is extracted. If the current IoT terminal has a session and the session attribute is in the shared mode, the parsed first session instruction is merged into the session with the same priority and the same resource identifier.
  • the method further includes:
  • a session termination success message carrying the logical session identifier, and deleting, by the IoT application, an application logical session node generated when the first session instruction is initiated, and terminating the session.
  • the termination session instruction that carries the logical session identifier sent by the Internet of Things application forwards the termination session instruction carrying the logical session identifier to the Internet of Things terminal, so that the Internet of Things terminal deletes the terminal logical session node according to the termination session instruction, where the terminal logical session A node is generated when an IoT terminal establishes a session connection with an IoT platform.
  • Terminating the success message causes the IoT application to delete the application logical session node and terminate the session, wherein the application logical session node is generated when the IoT application initiates the first session instruction.
  • the embodiment of the present invention further provides a method for implementing stateful operation in a stateless network protocol, which is applied to an Internet of Things application. As shown in FIG. 3, the method includes the following steps:
  • Step S201 initiating a first session instruction including a first physical session identifier to the Internet of Things platform, parsing the received first session instruction by the Internet of Things platform, and creating a platform logical session of the first session instruction after parsing After the node, establish a session connection with the Internet of Things terminal;
  • Step S202 receiving a logical session establishment success message that is sent by the Internet of Things platform and establishing the session connection with the Internet of Things terminal, and generating the logical session identifier, and the logical session establishment success message is obtained, and the logical session identifier is obtained and saved.
  • the Internet of Things platform feeds back a connection success message.
  • the Internet of Things application is software running on the user terminal.
  • the user terminal also has a session management software unit for initiating/terminating the session.
  • the interface provided by the session management is invoked. Therefore, the session management unit can serve multiple IoT applications on the user terminal, and one IoT terminal can run multiple IoT applications.
  • the IoT application first sends a first session instruction including the first physical session identifier to the Internet of Things platform, and generates an application logical session node while sending the first session instruction, so that the Internet of Things platform receives the first session instruction,
  • a session instruction parses, obtains an IoT terminal identifier and a session attribute carried in the first session instruction, and then finds a corresponding platform session linked list according to the IoT terminal identifier.
  • a plurality of IoT terminals constitute an IoT terminal list, and a list node in the IoT terminal list represents an IoT terminal, and the list node includes an IoT terminal identifier and a corresponding node node linked list first node address.
  • a platform logical session node that resolves the first session instruction is created under the platform session list. The session connection between the IoT terminal and the IoT terminal is then established by the IoT platform.
  • a logical session establishment success message sent after the IoT platform establishes a session connection with the IoT terminal and generates a logical session identifier where the logical session establishment success message includes a logical session identifier.
  • the logical session identifier is extracted and saved from the received logical session establishment success message, and the connection success message is fed back to the Internet of Things platform to complete the establishment of the logical session between the Internet of Things application and the Internet of Things terminal.
  • the method further includes:
  • the termination session instruction is sent by the IoT platform to the Internet of Things terminal, and receiving the IoT terminal is deleted and The session termination success message returned after the terminal logical session node is generated when the Internet of Things platform establishes a session connection;
  • the terminating session instruction carrying the logical session identifier is sent to the Internet of Things platform, so that the IoT platform sends the terminating session command to the Internet of Things terminal after receiving the terminating session command, and the IoT terminal terminates the session command according to the termination session command.
  • the success message receives the session termination success message sent by the Internet of Things platform, and deletes the application logical session node according to the session termination success message, and terminates the session process.
  • the embodiment of the present invention further provides a method for implementing stateful operation in a stateless network protocol, which is applied to an Internet of Things terminal. As shown in FIG. 4, the method includes the following steps:
  • Step S301 Receive a second session instruction sent by the Internet of Things platform, where the second session instruction is sent after the first logical session node is created by the IoT platform and the first physical session identifier is obtained between the IoT application and the IoT application. ;
  • Step S302 establishing a session connection with the Internet of Things platform, returning a session establishment message to the Internet of Things platform, and generating, by the IoT platform, a logical session between the Internet of Things application and the Internet of Things terminal Logical session identifier;
  • Step S303 Receive a logical session establishment success message that is sent by the Internet of Things platform and carry the logical session identifier, and complete the delivery of the message according to the logical session identifier and the Internet of Things application.
  • the platform logical session node that is configured to receive the first session instruction and the first session instruction is completed, and the platform logical session node of the first session instruction is configured to be stored, and after acquiring the first physical session identifier,
  • the Internet of Things platform sends a second session instruction to the Internet of Things terminal, and the Internet of Things terminal receives the second session instruction sent by the Internet of Things platform, establishes a session connection with the Internet of Things platform, and returns a session establishment message to the Internet of Things platform.
  • the IoT terminal receives the logical session establishment success message sent by the Internet of Things platform, wherein the logical session establishment success message carries the second physical session identifier returned by the Internet of Things terminal and the Internet of Things after the IoT platform receives the session establishment message.
  • the first physical session between the applications identifies the generated logical session identifier, according to the logical session identifier and the delivery of the IoT application completion message.
  • the method after receiving the second session instruction sent by the Internet of Things platform, the method further includes:
  • the terminal logical session node After receiving the second session instruction sent by the Internet of Things platform, the terminal logical session node is generated according to the second session instruction, the current logical session attribute is saved and set, and the session establishment message is returned to the Internet of Things platform.
  • the method further includes:
  • the terminating session instruction sent by the Internet of Things application is forwarded by the IoT platform, wherein the terminating session instruction carries a logical session identifier, and the terminal logical session node is deleted according to the termination session instruction carrying the logical session identifier; and then the Internet of Things is sent to the Internet of Things.
  • the platform sends a session termination success message carrying the logical session identifier, and the IoT platform deletes the platform logical session node according to the session termination success message and returns a session termination success message carrying the logical session identifier to the IoT application, and the IoT application deletes according to the session termination success message. Apply the logical session node to terminate the entire session process.
  • the overall process of establishing a logical session in the embodiment of the present invention includes the following steps:
  • Step S401 The Internet of Things application sends a first session instruction to the Internet of Things platform.
  • Step S402 the Internet of Things platform receives the first session instruction, and generates a platform according to the first session instruction.
  • Logical session node the Internet of Things platform receives the first session instruction, and generates a platform according to the first session instruction.
  • Step S403 The Internet of Things platform initiates a second session instruction to the Internet of Things terminal.
  • Step S404 The Internet of Things terminal receives the second session instruction, and generates a terminal logical session node.
  • Step S405 The Internet of Things terminal sends a session establishment message to the Internet of Things platform.
  • Step S406 After the IoT platform generates the logical session identifier, send a logical session establishment success message to the Internet of Things application and the Internet of Things terminal.
  • Step S407 the Internet of Things application and the Internet of Things terminal feed back a connection success message to the Internet of Things platform.
  • the process includes the following steps:
  • Step S501 The Internet of Things application sends a first instruction message, where the message includes a logical session identifier.
  • Step S502 The Internet of Things platform receives the first instruction message, parses the first instruction message, creates a platform logical session node, acquires a logical session identifier, and saves the first instruction message.
  • Step S503 The Internet of Things platform sends a second instruction message to the Internet of Things terminal of the logical session, where the message includes a logical session identifier.
  • Step S504 The IoT terminal receives the second instruction message, generates a terminal logical session node, saves the second instruction message, and generates an execution result according to the execution policy execution instruction.
  • Step S505 The Internet of Things terminal returns a response message to the Internet of Things platform, where the message includes a logical session identifier.
  • Step S506 The Internet of Things platform receives the response message returned by the Internet of Things terminal, parses and acquires the logical session identifier, generates a platform logical session node, and saves the response message.
  • Step S507 The Internet of Things platform returns a response message to the Internet of Things application, where the response message includes a logical session identifier.
  • Step S508 The Internet of Things application receives the response message, parses and obtains the execution result, and saves the response message.
  • the session termination process is performed. As shown in FIG. 7, the process includes the following steps:
  • Step S601 The Internet of Things application initiates a termination session instruction, and the message includes a logical session identifier.
  • Step S602 The Internet of Things platform forwards the termination session instruction.
  • Step S603 The Internet of Things terminal receives the termination session instruction, and deletes the terminal logical session node.
  • Step S604 The Internet of Things terminal returns a session termination success message to the Internet of Things platform, where the message includes a logical session identifier.
  • Step S605 The Internet of Things platform deletes the platform logical session node.
  • Step S606 The Internet of Things platform returns a session termination success message to the Internet of Things application, where the message includes a logical session identifier.
  • Step S607 The Internet of Things application receives the session termination success message, and deletes the application logical session node.
  • the embodiment of the present invention further provides a device for implementing stateful operation in a stateless network protocol, which is applied to an Internet of Things platform, and the device includes:
  • a first receiving module configured to receive a first session instruction initiated by the Internet of Things application, where the first session instruction is a logical session instruction including a first physical session identifier;
  • a processing processing module configured to: after the parsing the first session instruction, create a platform logical session node of the parsed first session instruction, and store the platform logical session node according to the priority to the object carried by the first session instruction The platform session list corresponding to the networked terminal identifier;
  • Establishing a generation module configured to establish a session connection between the Internet of Things terminals corresponding to the IoT terminal identifier carried by the first session instruction, and generate logic for performing a logical session between the Internet of Things application and the Internet of Things terminal Session identifier
  • a first returning module configured to return a logical session establishment success message carrying the logical session identifier to the Internet of Things application and the Internet of Things terminal, to enable the Internet of Things application and the Internet of Things terminal to pass the logical session Identifies the delivery of the completion message.
  • the establishing the generating module includes:
  • a sending submodule configured to send a second session instruction to the Internet of Things terminal
  • the first receiving submodule is configured to receive a session establishment message returned after the IoT terminal receives the second session instruction to generate a logical session node of the terminal.
  • the establishing the generating module further includes:
  • a second receiving sub-module configured to establish a session connection with the Internet of Things terminal, and receive a second physical session identifier returned by the Internet of Things terminal;
  • Generating a submodule configured to generate the logical session identifier according to the first physical session identifier and the second physical session identifier.
  • the creation processing module is further configured to: acquire an IoT terminal identifier and a session attribute carried in the first session instruction.
  • the creating a processing module includes:
  • a locating sub-module configured to search, in the IoT terminal list, whether the current IoT terminal corresponding to the IoT terminal identifier has a session according to the IoT terminal identifier carried in the first session instruction;
  • the processing submodule is configured to: if the current IoT terminal does not have a session, add a node in the IoT terminal list to store the first node address of the platform session linked list corresponding to the current IoT terminal, and create the platform logic a session node; if there is a session in the current IoT terminal, according to the first node address of the platform session list included in the current IoT terminal node, the corresponding platform session list is searched according to the priority, and the parsed first session instruction is placed in the session of the same priority At last.
  • the processing sub-module is further configured to: if the current IoT terminal has a session, and the session attribute is the shared mode, the first session instruction after parsing is merged into the same-level priority and the resource identifier is the same. In the conversation.
  • the device further includes:
  • a second receiving module configured to receive a termination session command that is sent by the Internet of Things application and that carries the logical session identifier
  • a first sending module configured to send the termination session instruction to the Internet of Things terminal, where the terminal logical session node generated when establishing a session connection with the Internet of Things platform is deleted by the Internet of Things terminal;
  • a third receiving module configured to receive a session termination success message sent by the Internet of Things terminal that carries the logical session identifier, and delete the platform logical session node;
  • a second returning module configured to return to the IoT application to carry the logical session identifier a session termination success message, wherein the application logical session node generated when the first session instruction is initiated is deleted by the IoT application, and the session is terminated.
  • the embodiment of the present invention further provides a device for implementing stateful operation in a stateless network protocol, which is applied to an Internet of Things application, and the device includes:
  • the initiating module is configured to initiate a first session instruction including the first physical session identifier to the Internet of Things platform, where the first session instruction received by the Internet of Things platform is parsed and the parsed first session instruction is created After the platform logical session node, establish a session connection with the Internet of Things terminal;
  • a processing module configured to receive a logical session establishment success message including the logical session identifier sent after the IoT platform establishes a session connection with the Internet of Things terminal, and generates a logical session identifier, and obtains the logical session identifier and saves And feeding back the connection success message to the Internet of Things platform.
  • the first session instruction carries an Internet of Things terminal identifier and a session attribute.
  • the initiating module is further configured to: generate an application logical session node.
  • the device further includes:
  • a second sending module configured to send a termination session instruction carrying the logical session identifier to the Internet of Things platform, where the termination session command is sent by the Internet of Things platform to the Internet of Things terminal, and the receiving Determining a session termination success message returned by the Internet of Things terminal after deleting the terminal logical session node generated when the session connection is established with the Internet of Things platform;
  • the first receiving processing module is configured to receive the session termination success message forwarded by the IoT platform after deleting the platform logical session node, delete the application logical session node, and terminate the session.
  • an embodiment of the present invention further provides a device for implementing stateful operation in a stateless network protocol, which is applied to an Internet of Things terminal, and the device includes:
  • a fourth receiving module configured to receive a second session instruction sent by the Internet of Things platform, where the second session instruction creates a platform logical session node for the IoT platform and acquires a first physical session with the Internet of Things application Sent after the identification;
  • Establishing a return module configured to establish a session connection with the Internet of Things platform, and return a session establishment message to the Internet of Things platform, wherein the Internet of Things application and the Internet of Things terminal are generated by the Internet of Things platform a logical session identifier between logical sessions;
  • the second receiving processing module is configured to receive a logical session establishment success message that is sent by the Internet of Things platform and that carries the logical session identifier, and complete the delivery of the message according to the logical session identifier and the Internet of Things application.
  • the fourth receiving module is further configured to: generate a terminal logical session node, extract the session attribute carried in the second session instruction, and save the session attribute.
  • the device further includes:
  • a fifth receiving module configured to receive, by the IoT application, a termination session instruction that is sent by the Internet of Things platform and that carries the logical session identifier;
  • Deleting a module, configured to delete the terminal logical session node according to the terminating session instruction
  • a third sending module configured to send a session termination success message carrying the logical session identifier to the Internet of Things platform, where the IoT platform deletes the platform logical session node and returns to the Internet of Things application The session termination success message identified by the logical session, the application logical session node is deleted by the Internet of Things application, and the session is terminated.
  • Embodiments of the present invention provide a method for implementing stateful operation in a stateless network protocol, which initiates a logical session instruction through an Internet of Things application, and after the Internet of Things platform parses the logical session instruction, creates a platform logical session node for storage; establishing and corresponding The session connection between the Internet of Things terminals generates a logical session identifier; sends a logical session establishment success message carrying the logical session identifier to the Internet of Things application and the Internet of Things terminal, and forms a message transmission between the Internet of Things application and the Internet of Things terminal, which can be solved
  • the session must be kept complete when the session is delivered, the requester is resent when the session is lost, and the problem cannot be operated when multiple senders send messages to the same receiver, so that the Internet of Things application in the stateless network is in the Internet of Things.
  • the terminal performs stateful operations.
  • a device for implementing stateful operation is a device applying the foregoing method, and all embodiments of the foregoing method are applicable to the device, and both can achieve the same or similar Beneficial effect.
  • the embodiment of the invention further provides a computer readable storage medium, which stores a computer executable finger
  • the method of implementing stateful operations in the above stateless network protocol applied to the Internet of Things platform is implemented when the computer executable instructions are executed.
  • Embodiments of the present invention also provide a computer readable storage medium storing computer executable instructions that, when executed, implement a method for implementing stateful operations in the above stateless network protocol applied to an Internet of Things application.
  • Embodiments of the present invention further provide a computer readable storage medium storing computer executable instructions, which when implemented, implement a method for implementing stateful operations in the above stateless network protocol applied to an Internet of Things terminal.
  • each module/unit in the above embodiment may be implemented in the form of hardware, for example, by implementing an integrated circuit to implement its corresponding function, or may be implemented in the form of a software function module, for example, executing a program stored in the memory by a processor. / instruction to achieve its corresponding function.
  • the embodiments of the present application are not limited to any particular form of combination of hardware and software.
  • the embodiment of the present invention provides a method and an apparatus for implementing a stateful operation in a stateless network protocol, which can solve the problem that the session must be kept complete when the session is delivered, the session is resent, and the multiple senders are sent to the sender.
  • the problem that the same receiving end cannot operate when sending a message enables the IoT application to perform stateful operations on the IoT terminal in a stateless network.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Multimedia (AREA)
  • Computer And Data Communications (AREA)

Abstract

Disclosed is a method for realizing a stateful operation in a stateless network protocol, comprising: receiving a first session instruction comprising a first physical session identifier and initiated by an Internet of Things application; after the first session instruction is parsed, creating a platform logic session node for the parsed first session instruction, and storing the platform logic session node in a platform session linked list corresponding to an Internet of Things terminal identifier carried by the first session instruction; establishing a session connection with an Internet of Things terminal corresponding to the Internet of Things terminal identifier carried by the first session instruction, and generating a logic session identifier; and returning a logic session establishment success message carrying the logic session identifier to the Internet of Things application and the Internet of Things terminal, so that the Internet of Things application and the Internet of Things terminal complete message delivery by means of the logic session identifier. The solution can solve a variety of problems existing in session delivery in the related art, and realizes a stateful operation of an Internet of Things application on an Internet of Things terminal in a stateless network.

Description

一种无状态网络协议中实现有状态操作的方法及装置Method and device for realizing stateful operation in stateless network protocol 技术领域Technical field
本申请涉及但不限于物联网技术领域,尤其涉及一种无状态网络协议中实现有状态操作的方法及装置。The present application relates to, but is not limited to, the field of Internet of Things technologies, and in particular, to a method and apparatus for implementing stateful operation in a stateless network protocol.
背景技术Background technique
资源可以被定义为一个可直接访问的、独立开发的、可部署的、可管理的和可维护的软件构件,它支持特定的数据。物联网面向资源架构(ROA,Resource-Oriented Architecture)是物联网基于表述性状态传递(Representational State Transfer,REST)风格的软件架构,物联网环境中的资源可以是某个终端设备、终端设备的某个能力、或者平台或应用的某个能力。在ROA中,数据交换都是以资源为中心进行操作,资源有共同的操作方式,即REST方式,REST设计包含几个基本特性,其中一个基本特征:无状态性(Statelessness),即每个对资源的请求(如:HTTP请求)都是孤立的,不依赖于其前或后的请求。但作为现实世界的实际需求,并不能保证每个操作都是独立的,而是存在或前或后的关联,参考下面几个场景。A resource can be defined as a directly accessible, independently developed, deployable, manageable, and maintainable software component that supports specific data. The Resource-Oriented Architecture (ROA) is a software architecture based on the Representational State Transfer (REST) style of the Internet of Things. The resources in the IoT environment can be a terminal device or a terminal device. A capability, or a capability of a platform or application. In ROA, data exchange is resource-centric operation. Resources have a common operation mode, namely REST mode. REST design contains several basic characteristics, one of which is basic statelessness (Statelessness), that is, each pair Resource requests (such as HTTP requests) are isolated and do not depend on their previous or subsequent requests. However, as the actual needs of the real world, there is no guarantee that each operation is independent, but there is an association with the front or the back. Refer to the following scenarios.
应用场景一:Application scenario 1:
当有两个或两个以上应用终端同时对同一个终端设备下发查询指令,查询指令需要对终端设备的设置修改,终端设备在执行查询操作前,根据应用终端的查询指令执行某个设置操作,当查询指令执行完成后,应用终端再恢复终端设备到原来的设置。在这个过程中,正在进行交互的应用终端需要与终端设备建立完整的会话过程,即设置-->查询-->恢复,需要串行地在一个会话过程连续完成。When two or more application terminals send query commands to the same terminal device at the same time, the query command needs to modify the settings of the terminal device, and the terminal device performs a certain setting operation according to the query instruction of the application terminal before performing the query operation. After the execution of the query instruction is completed, the application terminal restores the terminal device to the original setting. In this process, the application terminal that is undergoing interaction needs to establish a complete session process with the terminal device, that is, setting --> query --> recovery, and needs to be serially completed in a session process.
应用场景二:Application scenario 2:
在物联网无线机器对机器协议(Wireless Machine to Machine Protocol,WMMP)协议通信中,多个请求和应答可组成一个完整会话。此种情况下,应用数据包长度大于网络层一个报文包体最大长度时,会出现多包处理情况, 可以分几种情况:In the Internet of Things Wireless Machine to Machine Protocol (WMMP) protocol communication, multiple requests and responses can form a complete session. In this case, when the application packet length is greater than the maximum length of a packet body at the network layer, multi-packet processing may occur. Can be divided into several situations:
请求包分包。即在一个WMMP通信过程的会话中,请求方有一个数据请求包需要传送,应答方收到该请求后,返回的响应的数据包尺寸超过报文包体最大长度。此时,应答方将把这个应答以多包的形式向请求方发送数据分包,请求方在收到每个分包后则发送一个新请求,以请求下一个分包,直到收到最后一个分包。Request packet subcontracting. That is, in a session of a WMMP communication process, the requester has a data request packet to be transmitted, and after receiving the request, the responder returns a response packet whose packet size exceeds the maximum length of the packet body. At this point, the responder will send the response to the requester in the form of multiple packets, and the requester will send a new request after receiving each packet to request the next packet until the last one is received. Subcontracting.
应答包分包。即在一个WMMP通信过程的会话中,请求方的请求包数据包尺寸超过报文包体最大长度。此时请求方以多包方式向应答方发送数据分包,应答方收到分包后,返回该分包应答,请求方收到分包应答后发送下一分包,直到最后一个分包;应答方收到所有分包并处理后产生的应答报文小于报文包体最大长度,此时返回应答包。The response packet is subcontracted. That is, in a session of a WMMP communication process, the requester's request packet data packet size exceeds the maximum length of the packet body. At this time, the requester sends a data packet to the responder in a multi-packet manner. After receiving the packet, the responder returns the packet response, and the requester receives the packet response and then sends the next packet until the last packet is received; The response packet generated by the responder after receiving all the packets and processing is smaller than the maximum length of the packet body, and the response packet is returned at this time.
请求应答分包。此种方式是前面两种模式的组合。Request a reply to the subcontract. This way is a combination of the first two modes.
在前面情况,一个会话必须完整,否则通信双方视整个过程无效,如果在会话通信过程中,产生分包或分包响应丢失时,则由请求方重发请求。In the former case, a session must be complete, otherwise the communication parties will treat the entire process as invalid. If a packet or packet response is lost during the session communication, the requester will resend the request.
应用场景三:Application scenario three:
服务器与发送客户端和接收客户端基于无状态网络协议连接,在服务器的模拟连接层的连接状态表中建立至少两个会话节点,会话节点与两个客户端相对应;发送客户端发送请求信息至服务器,该请求信息包含准备发送到接收客户端的交流数据;服务器将上述交流数据暂存到接收客户端对应的会话节点;接收客户端发送请求信息至服务器,服务器确定发送客户端对应的会话节点,从模拟连接层的连接状态表中所确定的会话节点处获取暂存的交流数据,在回复信息中携带上述交流数据。可以解决无状态网络协议连接中,实现有状态的操作。但如果多个客户端向同一个接收客户端发送消息,或者多个客户端向同一个接收客户端发送独占资源的操作,比如,执行一个排它的查询操作,该场景无法解决。The server is connected to the sending client and the receiving client based on the stateless network protocol, and at least two session nodes are established in the connection state table of the simulated connection layer of the server, and the session node corresponds to the two clients; the sending client sends the request message. To the server, the request information includes the exchange data to be sent to the receiving client; the server temporarily stores the exchange data to the session node corresponding to the receiving client; the receiving client sends the request message to the server, and the server determines to send the session node corresponding to the client. The temporary exchange data is obtained from the session node determined in the connection state table of the simulation connection layer, and the communication data is carried in the reply information. It can solve stateless operations in stateless network protocol connections. However, if multiple clients send messages to the same receiving client, or multiple clients send exclusive resources to the same receiving client, for example, performing an exclusive query operation, the scenario cannot be resolved.
需要说明的是,“物联网”,即通过射频识别(RFID)、红外感应器、全球定位系统、激光扫描器等信息传感设备,按约定的协议,把任何物品与互联网连接起来,进行信息交换和通讯,以实现智能化识别、定位、跟踪、监控和管理的网络。 It should be noted that the "Internet of Things", that is, information sensing devices such as radio frequency identification (RFID), infrared sensors, global positioning systems, laser scanners, etc., connect any items to the Internet according to a contractual agreement, and carry out information. Exchange and communication to enable intelligent identification, location, tracking, monitoring and management of the network.
物联网体系架构可以划分成三个层次:感知层、网络层、应用层。感知层主要包括二维码标签和识读器、RFID标签和读写器、摄像头、全球定位系统、传感器、传感器网络和传感器网关等,感知层主要实现感知、识别物体,采集、捕获信息。The Internet of Things architecture can be divided into three levels: the perception layer, the network layer, and the application layer. The sensing layer mainly includes two-dimensional code labels and readers, RFID tags and readers, cameras, global positioning systems, sensors, sensor networks and sensor gateways. The sensing layer mainly realizes sensing, recognizing objects, collecting and capturing information.
网络层首先包括接入层和传输层,如由各种通信网络与互联网形成的融合网络;另外还包括各种共性平台,如物联网能力开放平台、物联网管理平台以及物联网信息中心、云计算平台、专家系统等,用于对海量信息进行管理及智能分析处理。The network layer first includes an access layer and a transport layer, such as a converged network formed by various communication networks and the Internet; and also includes various common platforms, such as an Internet of Things capability open platform, an Internet of Things management platform, and an Internet of Things information center, and a cloud. Computing platform, expert system, etc., for management and intelligent analysis of massive information.
应用层是物联网技术与行业专业领域技术相结合,实现广泛智能化应用的解决方案。The application layer is a combination of IoT technology and industry expertise to achieve a wide range of intelligent application solutions.
发明内容Summary of the invention
以下是对本文详细描述的主题的概述。本概述并非是为了限制权利要求的保护范围。The following is an overview of the topics detailed in this document. This Summary is not intended to limit the scope of the claims.
本发明实施例提供一种无状态网络协议中实现有状态操作的方法及装置,旨在解决相关技术中会话传递时会话必须保持完整、会话分包丢失时由请求方重新发送以及多个发送端向同一接收端发送消息时无法操作的问题,实现物联网应用在无状态网络中对物联网终端进行有状态的操作。Embodiments of the present invention provide a method and apparatus for implementing stateful operation in a stateless network protocol, which are intended to solve the problem in the related art that when a session is delivered, the session must remain intact, the session packet is lost, and the sender is resent and multiple senders are lost. The problem that the message cannot be operated when sending a message to the same receiving end enables the IoT application to perform stateful operations on the IoT terminal in the stateless network.
本发明实施例提供一种无状态网络协议中实现有状态操作的方法,应用于物联网平台,所述方法包括:An embodiment of the present invention provides a method for implementing a stateful operation in a stateless network protocol, which is applied to an Internet of Things platform, and the method includes:
接收物联网应用发起的第一会话指令,其中,所述第一会话指令为包括第一物理会话标识的逻辑会话指令;Receiving a first session instruction initiated by the Internet of Things application, where the first session instruction is a logical session instruction including a first physical session identifier;
对所述第一会话指令进行解析后创建解析后第一会话指令的平台逻辑会话节点,将所述平台逻辑会话节点根据优先级存放到所述第一会话指令携带的物联网终端标识对应的平台会话链表中;a platform logical session node that resolves the first session instruction and creates a parsed first session instruction, and stores the platform logical session node according to the priority to a platform corresponding to the IoT terminal identifier carried by the first session instruction In the conversation list;
与所述第一会话指令携带的物联网终端标识对应的物联网终端之间建立会话连接,生成使所述物联网应用与所述物联网终端之间进行逻辑会话的逻辑会话标识; Establishing a session connection between the Internet of Things terminals corresponding to the IoT terminal identifier carried by the first session instruction, and generating a logical session identifier for performing a logical session between the Internet of Things application and the Internet of Things terminal;
向所述物联网应用与所述物联网终端返回携带所述逻辑会话标识的逻辑会话建立成功消息,使所述物联网应用与所述物联网终端通过所述逻辑会话标识完成消息的传递。Returning, to the IoT application, the logical session establishment success message carrying the logical session identifier to the Internet of Things terminal, so that the Internet of Things application and the Internet of Things terminal complete the delivery of the message through the logical session identifier.
其中,所述与所述第一会话指令携带的物联网终端标识对应的物联网终端之间建立会话连接的步骤包括:The step of establishing a session connection between the Internet of Things terminals corresponding to the IoT terminal identifier carried by the first session instruction includes:
向所述物联网终端发送第二会话指令;Sending a second session instruction to the Internet of Things terminal;
接收所述物联网终端接收所述第二会话指令生成终端逻辑会话节点后返回的会话建立消息。Receiving a session establishment message returned by the IoT terminal after receiving the second session instruction to generate a logical session node of the terminal.
其中,所述生成使所述物联网应用与所述物联网终端之间进行逻辑会话的逻辑会话标识,包括:The generating, by the logical session identifier, a logical session between the Internet of Things application and the Internet of Things terminal, including:
创建解析后第一会话指令的平台逻辑会话节点后,获取所述第一物理会话标识;After the platform logical session node of the first session instruction is parsed, the first physical session identifier is obtained;
与所述物联网终端之间建立会话连接,接收所述物联网终端返回的第二物理会话标识;Establishing a session connection with the Internet of Things terminal, and receiving a second physical session identifier returned by the Internet of Things terminal;
根据所述第一物理会话标识和所述第二物理会话标识生成所述逻辑会话标识。Generating the logical session identifier according to the first physical session identifier and the second physical session identifier.
其中,所述对所述第一会话指令进行解析的步骤还包括:获取所述第一会话指令中携带的物联网终端标识和会话属性。The step of parsing the first session instruction further includes: acquiring an IoT terminal identifier and a session attribute carried in the first session instruction.
其中,所述对所述第一会话指令进行解析后创建解析后第一会话指令的平台逻辑会话节点,包括:The platform logical session node that creates the parsed first session instruction after parsing the first session instruction includes:
根据所述第一会话指令中携带的所述物联网终端标识在物联网终端列表中查找与所述物联网终端标识对应的当前物联网终端是否已存在会话;Determining, according to the Internet of Things terminal identifier carried in the first session instruction, whether a current Internet of Things terminal corresponding to the IoT terminal identifier exists in the Internet of Things terminal list;
若当前物联网终端不存在会话,在所述物联网终端列表中新增一个节点存放与当前物联网终端对应的平台会话链表的首节点地址,并创建所述平台逻辑会话节点;If there is no session in the current Internet of Things terminal, a node is added to the list of the Internet of Things terminals to store the first node address of the platform session linked list corresponding to the current Internet of Things terminal, and the platform logical session node is created;
若当前物联网终端存在会话,根据当前物联网终端节点包含的平台会话链表的首节点地址按照优先级查找对应平台会话链表,将解析后第一会话指令放在同级优先级的会话最后。 If there is a session in the current IoT terminal, the corresponding session session list is searched according to the priority of the first node address of the platform session list included in the current IoT terminal node, and the parsed first session instruction is placed at the end of the session of the same priority.
其中,所述方法还包括:若当前物联网终端存在会话,且会话属性为共享方式时,将解析后第一会话指令合并到同级优先级且资源标识相同的会话中。The method further includes: if the current IoT terminal has a session, and the session attribute is the shared mode, the first session instruction is parsed into a session with the same priority and the same resource identifier.
其中,所述方法还包括:The method further includes:
接收所述物联网应用发送的携带所述逻辑会话标识的终止会话指令;Receiving, by the IoT application, a termination session instruction carrying the logical session identifier;
将所述终止会话指令发送至所述物联网终端,由所述物联网终端删除与所述物联网平台建立会话连接时生成的终端逻辑会话节点;Transmitting the termination session instruction to the Internet of Things terminal, and deleting, by the IoT terminal, a terminal logical session node generated when a session connection is established with the Internet of Things platform;
接收所述物联网终端发送的携带所述逻辑会话标识的会话终止成功消息,并删除所述平台逻辑会话节点;Receiving a session termination success message sent by the IoT terminal carrying the logical session identifier, and deleting the platform logical session node;
向所述物联网应用返回携带所述逻辑会话标识的会话终止成功消息,由所述物联网应用删除发起所述第一会话指令时生成的应用逻辑会话节点,终止会话。Returning, to the IoT application, a session termination success message carrying the logical session identifier, and deleting, by the IoT application, an application logical session node generated when the first session instruction is initiated, and terminating the session.
本发明实施例还提供一种无状态网络协议中实现有状态操作的方法,应用于物联网应用,所述方法包括:The embodiment of the present invention further provides a method for implementing a stateful operation in a stateless network protocol, which is applied to an Internet of Things application, and the method includes:
向物联网平台发起包括第一物理会话标识的第一会话指令,由所述物联网平台对接收到的所述第一会话指令进行解析并创建解析后第一会话指令的平台逻辑会话节点后,与物联网终端之间建立会话连接;Initiating a first session instruction including a first physical session identifier to the Internet of Things platform, after the IoT platform parses the received first session instruction and creates a platform logical session node of the parsed first session instruction, Establish a session connection with the Internet of Things terminal;
接收所述物联网平台与所述物联网终端建立会话连接且生成逻辑会话标识后发送的包含所述逻辑会话标识的逻辑会话建立成功消息,解析获得所述逻辑会话标识并保存,向所述物联网平台反馈连接成功消息。Receiving a logical session establishment success message including the logical session identifier sent by the Internet of Things platform after establishing a session connection with the Internet of Things terminal and generating a logical session identifier, parsing and obtaining the logical session identifier, and saving, to the object The networking platform feeds back the connection success message.
其中,所述第一会话指令中携带有物联网终端标识和会话属性。The first session instruction carries an Internet of Things terminal identifier and a session attribute.
其中,所述向物联网平台发起第一会话指令时,所述方法还包括:生成应用逻辑会话节点。Wherein, when the first session instruction is initiated to the Internet of Things platform, the method further includes: generating an application logical session node.
其中,所述方法还包括:The method further includes:
向所述物联网平台发送携带所述逻辑会话标识的终止会话指令,由所述物联网平台将所述终止会话指令发送至所述物联网终端,并接收所述物联网终端在删除与所述物联网平台建立会话连接时生成的终端逻辑会话节点后返回的会话终止成功消息; Sending a termination session instruction carrying the logical session identifier to the Internet of Things platform, the termination session instruction is sent by the IoT platform to the Internet of Things terminal, and receiving the IoT terminal is deleted and The session termination success message returned after the terminal logical session node is generated when the Internet of Things platform establishes a session connection;
接收经所述物联网平台在删除平台逻辑会话节点后转发的所述会话终止成功消息,删除所述应用逻辑会话节点,终止会话。Receiving the session termination success message forwarded by the IoT platform after deleting the platform logical session node, deleting the application logical session node, and terminating the session.
本发明实施例还提供一种无状态网络协议中实现有状态操作的方法,应用于物联网终端,所述方法包括:The embodiment of the present invention further provides a method for implementing a stateful operation in a stateless network protocol, which is applied to an Internet of Things terminal, and the method includes:
接收物联网平台发送的第二会话指令,其中,所述第二会话指令为所述物联网平台创建平台逻辑会话节点且获取与物联网应用之间的第一物理会话标识后发送的;Receiving a second session instruction sent by the Internet of Things platform, where the second session instruction is sent after the first logical session node is created by the IoT platform and the first physical session identifier is obtained between the IoT application;
与所述物联网平台之间建立会话连接,向所述物联网平台返回会话建立消息,由所述物联网平台生成使所述物联网应用与所述物联网终端之间进行逻辑会话的逻辑会话标识;Establishing a session connection with the IoT platform, returning a session establishment message to the IoT platform, and generating, by the IoT platform, a logical session for performing a logical session between the IoT application and the IoT terminal Identification
接收所述物联网平台发送的携带所述逻辑会话标识的逻辑会话建立成功消息,根据所述逻辑会话标识与所述物联网应用完成消息的传递。Receiving, by the IoT platform, a logical session establishment success message carrying the logical session identifier, and transmitting the message according to the logical session identifier and the Internet of Things application completion message.
其中,所述接收物联网平台发送的第二会话指令后,所述方法还包括:生成终端逻辑会话节点;提取所述第二会话指令中携带的会话属性,并保存。After the receiving the second session instruction sent by the Internet of Things platform, the method further includes: generating a terminal logical session node; extracting the session attribute carried in the second session instruction, and saving.
其中,所述方法还包括:The method further includes:
接收由所述物联网应用发送经所述物联网平台转发的携带所述逻辑会话标识的终止会话指令;Receiving, by the IoT application, sending a termination session instruction that is forwarded by the Internet of Things platform and carrying the logical session identifier;
根据所述终止会话指令,删除所述终端逻辑会话节点;Deleting the terminal logical session node according to the terminating session instruction;
向所述物联网平台发送携带所述逻辑会话标识的会话终止成功消息,由所述物联网平台删除所述平台逻辑会话节点后向所述物联网应用返回携带所述逻辑会话标识的会话终止成功消息,由所述物联网应用删除应用逻辑会话节点,终止会话。Sending a session termination success message carrying the logical session identifier to the Internet of Things platform, and deleting, by the Internet of Things platform, the platform logical session node, returning to the IoT application, the session carrying the logical session identifier is successfully terminated. The message is deleted by the IoT application to terminate the session.
本发明实施例还提供一种无状态网络协议中实现有状态操作的装置,应用于物联网平台,所述装置包括:The embodiment of the present invention further provides a device for implementing stateful operation in a stateless network protocol, which is applied to an Internet of Things platform, and the device includes:
第一接收模块,设置为接收物联网应用发起的第一会话指令,其中,所述第一会话指令为包括第一物理会话标识的逻辑会话指令;a first receiving module, configured to receive a first session instruction initiated by the Internet of Things application, where the first session instruction is a logical session instruction including a first physical session identifier;
创建处理模块,设置为对所述第一会话指令进行解析后创建解析后第一会话指令的平台逻辑会话节点,将所述平台逻辑会话节点根据优先级存放到 所述第一会话指令携带的物联网终端标识对应的平台会话链表中;a processing processing module is configured to: after parsing the first session instruction, create a platform logical session node of the parsed first session instruction, and store the platform logical session node according to the priority The platform session list corresponding to the IoT terminal identifier carried by the first session instruction;
建立生成模块,设置为与所述第一会话指令携带的物联网终端标识对应的物联网终端之间建立会话连接,生成使所述物联网应用与所述物联网终端之间进行逻辑会话的逻辑会话标识;Establishing a generation module, configured to establish a session connection between the Internet of Things terminals corresponding to the IoT terminal identifier carried by the first session instruction, and generate logic for performing a logical session between the Internet of Things application and the Internet of Things terminal Session identifier
第一返回模块,设置为向所述物联网应用与所述物联网终端返回携带所述逻辑会话标识的逻辑会话建立成功消息,使所述物联网应用与所述物联网终端通过所述逻辑会话标识完成消息的传递。a first returning module, configured to return a logical session establishment success message carrying the logical session identifier to the Internet of Things application and the Internet of Things terminal, to enable the Internet of Things application and the Internet of Things terminal to pass the logical session Identifies the delivery of the completion message.
其中,所述建立生成模块包括:The establishing the generating module includes:
发送子模块,设置为向所述物联网终端发送第二会话指令;a sending submodule, configured to send a second session instruction to the Internet of Things terminal;
第一接收子模块,设置为接收所述物联网终端接收所述第二会话指令生成终端逻辑会话节点后返回的会话建立消息。The first receiving submodule is configured to receive a session establishment message returned after the IoT terminal receives the second session instruction to generate a logical session node of the terminal.
其中,所述建立生成模块包括:The establishing the generating module includes:
获取子模块,设置为创建解析后第一会话指令的平台逻辑会话节点后,获取所述第一物理会话标识;Obtaining the sub-module, and setting the first physical session identifier after setting the platform logical session node of the parsed first session instruction;
第二接收子模块,设置为与所述物联网终端之间建立会话连接,接收所述物联网终端返回的第二物理会话标识;a second receiving sub-module, configured to establish a session connection with the Internet of Things terminal, and receive a second physical session identifier returned by the Internet of Things terminal;
生成子模块,设置为根据所述第一物理会话标识和所述第二物理会话标识生成所述逻辑会话标识。Generating a submodule, configured to generate the logical session identifier according to the first physical session identifier and the second physical session identifier.
其中,所述创建处理模块还设置为:获取所述第一会话指令中携带的物联网终端标识和会话属性。The creation processing module is further configured to: acquire an IoT terminal identifier and a session attribute carried in the first session instruction.
其中,所述创建处理模块包括:The creation processing module includes:
查找子模块,设置为根据所述第一会话指令中携带的所述物联网终端标识在物联网终端列表中查找与所述物联网终端标识对应的当前物联网终端是否已存在会话;a locating sub-module, configured to search, in the IoT terminal list, whether the current IoT terminal corresponding to the IoT terminal identifier has a session according to the IoT terminal identifier carried in the first session instruction;
处理子模块,设置为:若当前物联网终端不存在会话,在所述物联网终端列表中新增一个节点存放与当前物联网终端对应的平台会话链表的首节点地址,并创建所述平台逻辑会话节点;若当前物联网终端存在会话,根据当 前物联网终端节点包含的平台会话链表的首节点地址按照优先级查找对应平台会话链表,将解析后第一会话指令放在同级优先级的会话最后。The processing submodule is configured to: if the current IoT terminal does not have a session, add a node in the IoT terminal list to store the first node address of the platform session linked list corresponding to the current IoT terminal, and create the platform logic Session node; if there is a session in the current IoT terminal, according to The first node address of the platform session list included in the previous IoT terminal node searches the corresponding platform session list according to the priority, and places the parsed first session instruction at the end of the session of the same priority.
其中,所述处理子模块还设置为:若当前物联网终端存在会话,且会话属性为共享方式时,将解析后第一会话指令合并到同级优先级且资源标识相同的会话中。The processing sub-module is further configured to: if the current IoT terminal has a session, and the session attribute is the shared mode, the first session instruction is parsed into a session with the same priority and the same resource identifier.
其中,所述装置还包括:Wherein, the device further comprises:
第二接收模块,设置为接收所述物联网应用发送的携带所述逻辑会话标识的终止会话指令;a second receiving module, configured to receive a termination session command that is sent by the Internet of Things application and that carries the logical session identifier;
第一发送模块,设置为将所述终止会话指令发送至所述物联网终端,由所述物联网终端删除与所述物联网平台建立会话连接时生成的终端逻辑会话节点;a first sending module, configured to send the termination session instruction to the Internet of Things terminal, and delete, by the IoT terminal, a terminal logical session node generated when establishing a session connection with the Internet of Things platform;
第三接收模块,设置为接收所述物联网终端发送的携带所述逻辑会话标识的会话终止成功消息,并删除所述平台逻辑会话节点;a third receiving module, configured to receive a session termination success message sent by the Internet of Things terminal that carries the logical session identifier, and delete the platform logical session node;
第二返回模块,设置为向所述物联网应用返回携带所述逻辑会话标识的会话终止成功消息,其中,由所述物联网应用删除发起所述第一会话指令时生成的应用逻辑会话节点,终止会话。a second returning module, configured to return a session termination success message carrying the logical session identifier to the Internet of Things application, where the application logical session node generated when the first session instruction is initiated is deleted by the Internet of Things application, Terminate the session.
本发明实施例还提供一种无状态网络协议中实现有状态操作的装置,应用于物联网应用,所述装置包括:The embodiment of the present invention further provides a device for implementing stateful operation in a stateless network protocol, which is applied to an Internet of Things application, and the device includes:
发起模块,设置为向物联网平台发起包括第一物理会话标识的第一会话指令,其中,由所述物联网平台对接收到的所述第一会话指令进行解析并创建解析后第一会话指令的平台逻辑会话节点后,与物联网终端之间建立会话连接;The initiating module is configured to initiate a first session instruction including the first physical session identifier to the Internet of Things platform, where the first session instruction received by the Internet of Things platform is parsed and the parsed first session instruction is created After the platform logical session node, establish a session connection with the Internet of Things terminal;
处理模块,设置为接收所述物联网平台与所述物联网终端建立会话连接且生成逻辑会话标识后发送的包含所述逻辑会话标识的逻辑会话建立成功消息,解析获得所述逻辑会话标识并保存,向所述物联网平台反馈连接成功消息。a processing module, configured to receive a logical session establishment success message including the logical session identifier sent after the IoT platform establishes a session connection with the Internet of Things terminal, and generates a logical session identifier, and obtains the logical session identifier and saves And feeding back the connection success message to the Internet of Things platform.
其中,所述第一会话指令中携带有物联网终端标识和会话属性。The first session instruction carries an Internet of Things terminal identifier and a session attribute.
其中,所述发起模块还设置为:生成应用逻辑会话节点。 The initiating module is further configured to: generate an application logical session node.
其中,所述装置还包括:Wherein, the device further comprises:
第二发送模块,设置为向所述物联网平台发送携带所述逻辑会话标识的终止会话指令,其中,由所述物联网平台将所述终止会话指令发送至所述物联网终端,并接收所述物联网终端在删除与所述物联网平台建立会话连接时生成的终端逻辑会话节点后返回的会话终止成功消息;a second sending module, configured to send a termination session instruction carrying the logical session identifier to the Internet of Things platform, where the termination session command is sent by the Internet of Things platform to the Internet of Things terminal, and the receiving Determining a session termination success message returned by the Internet of Things terminal after deleting the terminal logical session node generated when the session connection is established with the Internet of Things platform;
第一接收处理模块,设置为接收经所述物联网平台在删除平台逻辑会话节点后转发的所述会话终止成功消息,删除所述应用逻辑会话节点,终止会话。The first receiving processing module is configured to receive the session termination success message forwarded by the IoT platform after deleting the platform logical session node, delete the application logical session node, and terminate the session.
本发明实施例还提供一种无状态网络协议中实现有状态操作的装置,应用于物联网终端,所述装置包括:The embodiment of the present invention further provides a device for implementing stateful operation in a stateless network protocol, which is applied to an Internet of Things terminal, and the device includes:
第四接收模块,设置为接收物联网平台发送的第二会话指令,其中,所述第二会话指令为所述物联网平台创建平台逻辑会话节点且获取与物联网应用之间的第一物理会话标识后发送的;a fourth receiving module, configured to receive a second session instruction sent by the Internet of Things platform, where the second session instruction creates a platform logical session node for the IoT platform and acquires a first physical session with the Internet of Things application Sent after the identification;
建立返回模块,设置为与所述物联网平台之间建立会话连接,向所述物联网平台返回会话建立消息,其中,由所述物联网平台生成使所述物联网应用与所述物联网终端之间进行逻辑会话的逻辑会话标识;Establishing a return module, configured to establish a session connection with the Internet of Things platform, and return a session establishment message to the Internet of Things platform, wherein the Internet of Things application and the Internet of Things terminal are generated by the Internet of Things platform a logical session identifier between logical sessions;
第二接收处理模块,设置为接收所述物联网平台发送的携带所述逻辑会话标识的逻辑会话建立成功消息,根据所述逻辑会话标识与所述物联网应用完成消息的传递。The second receiving processing module is configured to receive a logical session establishment success message that is sent by the Internet of Things platform and that carries the logical session identifier, and complete the delivery of the message according to the logical session identifier and the Internet of Things application.
其中,所述第四接收模块还设置为:生成终端逻辑会话节点,提取所述第二会话指令中携带的会话属性,并保存。The fourth receiving module is further configured to: generate a logical session node of the terminal, extract the session attribute carried in the second session instruction, and save the session attribute.
其中,所述装置还包括:Wherein, the device further comprises:
第五接收模块,设置为接收由所述物联网应用发送经所述物联网平台转发的携带所述逻辑会话标识的终止会话指令;a fifth receiving module, configured to receive, by the IoT application, a termination session instruction that is sent by the Internet of Things platform and that carries the logical session identifier;
删除模块,设置为根据所述终止会话指令,删除所述终端逻辑会话节点;Deleting a module, configured to delete the terminal logical session node according to the terminating session instruction;
第三发送模块,设置为向所述物联网平台发送携带所述逻辑会话标识的会话终止成功消息,其中,由所述物联网平台删除所述平台逻辑会话节点后向所述物联网应用返回携带所述逻辑会话标识的会话终止成功消息,由所述 物联网应用删除应用逻辑会话节点,终止会话。a third sending module, configured to send a session termination success message carrying the logical session identifier to the Internet of Things platform, where the IoT platform deletes the platform logical session node and returns to the Internet of Things application a session termination success message identified by the logical session, by the The IoT application deletes the application logical session node and terminates the session.
本发明实施例还提供一种计算机可读存储介质,存储有计算机可执行指令,所述计算机可执行指令被执行时实现应用于物联网平台的上述无状态网络协议中实现有状态操作的方法。Embodiments of the present invention further provide a computer readable storage medium storing computer executable instructions that, when executed, implement a method for implementing stateful operations in the above stateless network protocol applied to an Internet of Things platform.
本发明实施例还提供一种计算机可读存储介质,存储有计算机可执行指令,所述计算机可执行指令被执行时实现应用于物联网应用的上述无状态网络协议中实现有状态操作的方法。Embodiments of the present invention also provide a computer readable storage medium storing computer executable instructions that, when executed, implement a method for implementing stateful operations in the above stateless network protocol applied to an Internet of Things application.
本发明实施例还提供一种计算机可读存储介质,存储有计算机可执行指令,所述计算机可执行指令被执行时实现应用于物联网终端的上述无状态网络协议中实现有状态操作的方法。Embodiments of the present invention further provide a computer readable storage medium storing computer executable instructions, which when implemented, implement a method for implementing stateful operations in the above stateless network protocol applied to an Internet of Things terminal.
本发明实施例的上述技术方案至少包括如下有益效果:The foregoing technical solutions of the embodiments of the present invention include at least the following beneficial effects:
本发明实施例通过物联网应用发起逻辑会话指令,物联网平台对逻辑会话指令进行解析后,创建平台逻辑会话节点进行存储;建立与相应物联网终端之间的会话连接,生成逻辑会话标识;向物联网应用和物联网终端发送携带逻辑会话标识的逻辑会话建立成功消息,形成物联网应用与物联网终端之间消息的传递,可以解决相关技术中会话传递时会话必须保持完整、会话分包丢失时由请求方重新发送以及多个发送端向同一接收端发送消息时无法操作的问题,实现物联网应用在无状态网络中对物联网终端进行有状态的操作。The embodiment of the present invention initiates a logical session instruction through the Internet of Things application, and after the Internet of Things platform parses the logical session instruction, creates a platform logical session node for storage; establishes a session connection with the corresponding IoT terminal, and generates a logical session identifier; The Internet of Things application and the Internet of Things terminal send a logical session establishment success message carrying the logical session identifier to form a message transmission between the Internet of Things application and the Internet of Things terminal, which can solve the problem that the session must be kept intact and the session packet is lost when the session is delivered in the related art. When the requester resends and the multiple senders cannot send a message to the same receiver, the IoT application can perform stateful operations on the IoT terminal in the stateless network.
在阅读并理解了附图和详细描述后,可以明白其他方面。Other aspects will be apparent upon reading and understanding the drawings and detailed description.
附图概述BRIEF abstract
图1为本发明实施例的无状态网络协议中实现有状态操作的方法示意图一;1 is a first schematic diagram of a method for implementing stateful operation in a stateless network protocol according to an embodiment of the present invention;
图2为本发明实施例的物联网终端列表示意图;2 is a schematic diagram of a list of an Internet of Things terminal according to an embodiment of the present invention;
图3为本发明实施例的无状态网络协议中实现有状态操作的方法示意图二;3 is a second schematic diagram of a method for implementing stateful operation in a stateless network protocol according to an embodiment of the present invention;
图4为本发明实施例的无状态网络协议中实现有状态操作的方法示意图三; 4 is a third schematic diagram of a method for implementing stateful operation in a stateless network protocol according to an embodiment of the present invention;
图5为本发明实施例的逻辑会话建立整体流程示意图;FIG. 5 is a schematic flowchart of an overall process of establishing a logical session according to an embodiment of the present invention; FIG.
图6为本发明实施例的消息传递流程示意图;6 is a schematic diagram of a message delivery process according to an embodiment of the present invention;
图7为本发明实施例的终止逻辑会话流程示意图;FIG. 7 is a schematic flowchart of a termination logical session according to an embodiment of the present invention;
图8为本发明实施例的无状态网络协议中实现有状态操作的装置示意图一;8 is a first schematic diagram of an apparatus for implementing stateful operation in a stateless network protocol according to an embodiment of the present invention;
图9为本发明实施例的无状态网络协议中实现有状态操作的装置示意图二;FIG. 9 is a second schematic diagram of an apparatus for implementing stateful operation in a stateless network protocol according to an embodiment of the present invention; FIG.
图10为本发明实施例的无状态网络协议中实现有状态操作的装置示意图三。FIG. 10 is a third schematic diagram of an apparatus for implementing stateful operation in a stateless network protocol according to an embodiment of the present invention.
本发明的实施方式Embodiments of the invention
下面将结合附图及具体实施例进行详细描述。The detailed description will be made below in conjunction with the accompanying drawings and specific embodiments.
在本发明实施例中,物联网终端、物联网平台、物联网应用分别代表感知层、网络层及应用层。In the embodiment of the present invention, the Internet of Things terminal, the Internet of Things platform, and the Internet of Things application respectively represent the sensing layer, the network layer, and the application layer.
本发明实施例提供一种无状态网络协议中实现有状态操作的方法,应用于物联网平台,如图1所示,所述方法包括以下步骤:An embodiment of the present invention provides a method for implementing stateful operation in a stateless network protocol, which is applied to an Internet of Things platform. As shown in FIG. 1 , the method includes the following steps:
步骤S101、接收物联网应用发起的第一会话指令,其中,所述第一会话指令为包括第一物理会话标识的逻辑会话指令;Step S101: Receive a first session instruction initiated by an Internet of Things application, where the first session instruction is a logical session instruction including a first physical session identifier;
步骤S102、对所述第一会话指令进行解析后创建解析后第一会话指令的平台逻辑会话节点,将所述平台逻辑会话节点根据优先级存放到所述第一会话指令携带的物联网终端标识对应的平台会话链表中;Step S102: After the first session instruction is parsed, the platform logical session node of the parsed first session instruction is created, and the platform logical session node is stored according to the priority to the IoT terminal identifier carried by the first session instruction. Corresponding platform session list;
步骤S103、与所述第一会话指令携带的物联网终端标识对应的物联网终端之间建立会话连接,生成使所述物联网应用与所述物联网终端之间进行逻辑会话的逻辑会话标识;Step S103: Establish a session connection between the Internet of Things terminals corresponding to the IoT terminal identifier carried by the first session instruction, and generate a logical session identifier for performing a logical session between the Internet of Things application and the Internet of Things terminal;
步骤S104、向所述物联网应用与所述物联网终端返回携带所述逻辑会话标识的逻辑会话建立成功消息,使所述物联网应用与所述物联网终端通过所述逻辑会话标识完成消息的传递。 Step S104: Returning, to the Internet of Things application, the logical session establishment success message carrying the logical session identifier to the Internet of Things terminal, so that the Internet of Things application and the Internet of Things terminal complete the message through the logical session identifier transfer.
通过上述步骤,可以使得物联网应用与物联网终端之间通过逻辑会话标识完成消息的传递,实现物联网应用在无状态网络中对物联网终端进行有状态的操作。Through the above steps, the communication between the Internet of Things application and the Internet of Things terminal can be completed through the logical session identification, so that the Internet of Things application can perform stateful operations on the Internet of Things terminal in the stateless network.
物联网平台是一个比较广泛的概念,在实际应用中,物联网平台可以是由一个或多个设备构成,如物联网能力开放平台、物联网管理平台、物联网信息中心等。The Internet of Things platform is a relatively broad concept. In practical applications, the Internet of Things platform can be composed of one or more devices, such as the Internet of Things capability open platform, the Internet of Things management platform, and the Internet of Things information center.
其中,物联网平台接收物联网应用发送的包括第一物理会话标识的第一会话指令,且第一会话指令实质上为逻辑会话指令。The IoT platform receives the first session instruction that is sent by the IoT application and includes the first physical session identifier, and the first session instruction is substantially a logical session instruction.
需要说明的是,逻辑会话包含多个网络层/传输层的端到端连接,与开放系统互连参考(Open System Interconnect,OSI)模型第5层会话层不同,OSI会话层主要为两个会话层实体进行会话而提供的对话连接的管理服务,OSI会话层依赖网络层/传输层的端到端连接。简单讲,逻辑会话可以包含多个OSI会话层。如用户A和服务器S连接时所创建的会话同终端设备D和服务器S连接时所创建的会话是两个不同的会话。在物联网架构环境中,则需要用户A到终端设备D建立一个端到端的会话,这个会话会包含用户A和服务器S及终端设备D和服务器S的会话。为了区别两种会话,本发明实施例中称包含多个会话的会话为逻辑会话,被包含在逻辑会话的一般会话称为物理会话。It should be noted that the logical session includes multiple network layer/transport layer end-to-end connections, which is different from the Open System Interconnect (OSI) model layer 5 session layer. The OSI session layer is mainly two sessions. The management service of the dialog connection provided by the layer entity for the session, the OSI session layer relies on the end-to-end connection of the network layer/transport layer. Simply put, a logical session can contain multiple OSI session layers. The session created when the session created when user A and server S are connected to terminal device D and server S is two different sessions. In the IoT architecture environment, user A is required to establish an end-to-end session with terminal device D. This session will contain sessions between user A and server S and terminal device D and server S. In order to distinguish between two types of sessions, a session including multiple sessions is referred to as a logical session, and a general session included in a logical session is referred to as a physical session.
物联网平台在接收第一会话指令后,对第一会话指令进行解析,然后创建解析后第一会话指令的平台逻辑会话节点,每个平台逻辑会话节点表示一个会话,平台逻辑会话节点包含了会话属性、优先级等。需要说明的是,平台逻辑会话节点即为物联网平台创建的逻辑会话节点,创建平台逻辑会话节点后存储在相应的平台会话链表中。After receiving the first session instruction, the Internet of Things platform parses the first session instruction, and then creates a platform logical session node of the parsed first session instruction, each platform logical session node represents a session, and the platform logical session node includes the session Attributes, priorities, etc. It should be noted that the platform logical session node is a logical session node created by the Internet of Things platform, and the platform logical session node is created and stored in the corresponding platform session list.
平台会话链表由一个或多个平台逻辑会话节点构成,每个物联网终端唯一对应一个平台会话链表,物联网平台在创建表示会话的平台逻辑会话节点后,通过物联网终端标识找到该物联网终端对应的平台会话链表,并通过平台会话链表的首节点地址,将创建的平台逻辑会话节点根据优先级放到平台会话链表的合适位置。The platform session list is composed of one or more platform logical session nodes, and each IoT terminal uniquely corresponds to a platform session list. After the IoT platform creates a platform logical session node representing the session, the IoT terminal identifies the IoT terminal. Corresponding platform session list, and through the first node address of the platform session list, the created platform logical session node is placed in the appropriate position of the platform session list according to the priority.
每个平台会话链表的首节点包含两个数据链表:指令消息链表和响应消 息链表。指令消息链表存储一个或多个物联网应用发送到物联网终端的消息,响应消息链表存储该物联网终端发送到一个或多个物联网应用的消息,响应消息根据物联网应用标识也建立物联网应用对应的链表,物联网平台根据物联网应用链表快速查询物联网应用所对应的待发数据,响应消息链表主要用于物联网终端的消息上报。The first node of each platform session list contains two data linked lists: instruction message list and response Interest list. The instruction message linked list stores one or more messages sent by the Internet of Things application to the Internet of Things terminal, and the response message linked list stores the message sent by the IoT terminal to one or more IoT applications, and the response message also establishes the Internet of Things according to the IoT application identifier. Applying the corresponding linked list, the Internet of Things platform quickly queries the pending data corresponding to the Internet of Things application according to the IoT application linked list, and the response message linked list is mainly used for reporting the information of the Internet of Things terminal.
物联网平台与第一会话指令携带的物联网终端标识对应的物联网终端建立会话连接后,生成逻辑会话标识,使得物联网应用与物联网终端之间可以进行逻辑会话。然后,物联网平台向物联网应用与物联网终端返回携带逻辑会话标识的逻辑会话建立成功消息,完成物联网应用与物联网终端之间消息的传递。After the IoT platform establishes a session connection with the IoT terminal corresponding to the IoT terminal identifier carried by the first session instruction, a logical session identifier is generated, so that a logical session can be performed between the Internet of Things application and the IoT terminal. Then, the Internet of Things platform returns a logical session establishment success message carrying the logical session identifier to the Internet of Things application and the Internet of Things terminal, and completes the delivery of the message between the Internet of Things application and the Internet of Things terminal.
在本发明实施例中,步骤S103中,与所述第一会话指令携带的物联网终端标识对应的物联网终端之间建立会话连接包括:In the embodiment of the present invention, in step S103, establishing a session connection between the Internet of Things terminals corresponding to the identifier of the Internet of Things terminal carried by the first session instruction includes:
向所述物联网终端发送第二会话指令;Sending a second session instruction to the Internet of Things terminal;
接收所述物联网终端接收所述第二会话指令生成终端逻辑会话节点后返回的会话建立消息。Receiving a session establishment message returned by the IoT terminal after receiving the second session instruction to generate a logical session node of the terminal.
其中,物联网平台在接收第一会话指令且对第一会话指令解析完成,创建解析后第一会话指令的平台逻辑会话节点,将平台逻辑会话节点根据优先级存放到第一会话指令携带的物联网终端标识对应的平台会话链表中后,向与第一会话指令携带的物联网终端标识对应的物联网终端发送第二会话指令,使得物联网终端在接收到第二会话指令后,生成终端逻辑会话节点,并向物联网平台返回会话建立消息,物联网平台在接收到物联网终端返回的会话建立消息后,完成与物联网终端之间的会话连接。The IoT platform receives the first session instruction and parses the first session instruction, creates a platform logical session node of the first session instruction after parsing, and stores the platform logical session node according to the priority to the object carried by the first session instruction. After the networked terminal identifies the corresponding platform session list, the second session instruction is sent to the Internet of Things terminal corresponding to the IoT terminal identifier carried by the first session instruction, so that the Internet of Things terminal generates the terminal logic after receiving the second session instruction. The session node returns a session establishment message to the Internet of Things platform, and the Internet of Things platform completes the session connection with the Internet of Things terminal after receiving the session establishment message returned by the Internet of Things terminal.
在本发明实施例中,步骤S103中,生成使所述物联网应用与所述物联网终端之间进行逻辑会话的逻辑会话标识,包括:In the embodiment of the present invention, in step S103, generating a logical session identifier for performing a logical session between the Internet of Things application and the Internet of Things terminal, including:
创建解析后第一会话指令的平台逻辑会话节点后,获取所述第一物理会话标识;After the platform logical session node of the first session instruction is parsed, the first physical session identifier is obtained;
与所述物联网终端之间建立会话连接,接收所述物联网终端返回的第二物理会话标识; Establishing a session connection with the Internet of Things terminal, and receiving a second physical session identifier returned by the Internet of Things terminal;
根据所述第一物理会话标识和所述第二物理会话标识生成所述逻辑会话标识。Generating the logical session identifier according to the first physical session identifier and the second physical session identifier.
其中,物联网平台在接收第一会话指令后,对第一会话指令进行解析且创建解析后第一会话指令的平台逻辑会话节点后,获取与物联网应用之间的第一物理会话标识。物联网平台在与物联网终端之间建立会话连接后,接收物联网终端返回的第二物理会话标识。根据第一物理会话标识和物联网终端发送的第二物理会话标识,另加时间戳,通过哈希函数生成逻辑会话标识。需要说明的是,第一物理会话标识存储于第一会话指令中,当物联网平台对第一会话指令进行解析且创建解析后第一会话指令的平台逻辑会话节点后,获取与物联网应用之间的第一物理会话标识;当物联网平台向物联网终端发送第二会话指令,由物联网终端接收第二会话指令后,生成终端逻辑会话节点并返回与物联网平台之间的第二物理会话标识。The IoT platform obtains the first physical session identifier between the IoT application and the IoT application after the first session instruction is parsed and the platform logical session node of the first session instruction is parsed. After establishing the session connection with the Internet of Things terminal, the Internet of Things platform receives the second physical session identifier returned by the Internet of Things terminal. And generating a logical session identifier by using a hash function according to the first physical session identifier and the second physical session identifier sent by the Internet of Things terminal. It should be noted that the first physical session identifier is stored in the first session instruction, and after the Internet of Things platform parses the first session instruction and creates a platform logical session node of the first session instruction after parsing, acquiring the application with the Internet of Things a first physical session identifier; when the Internet of Things platform sends a second session instruction to the Internet of Things terminal, and after receiving the second session instruction by the Internet of Things terminal, generating a terminal logical session node and returning a second physics with the Internet of Things platform Session ID.
在本发明实施例中,步骤S102中,对所述第一会话指令进行解析的步骤还包括:In the embodiment of the present invention, the step of parsing the first session instruction in step S102 further includes:
获取所述第一会话指令中携带的物联网终端标识和会话属性。Obtaining an IoT terminal identifier and a session attribute carried in the first session instruction.
其中,物联网平台在对第一会话指令进行解析时,获取第一会话指令中携带的物联网终端标识以及会话属性。会话属性包括:共享或独占,如果是独占访问,设置锁机制,并对访问请求进行排队。这样保证在物联网环境中,多个物联网应用访问同一个物联网终端时,不会造成非法访问。The IoT platform acquires the IoT terminal identifier and the session attribute carried in the first session instruction when parsing the first session instruction. Session attributes include: shared or exclusive, if it is exclusive access, set the lock mechanism, and queue access requests. This ensures that in the IoT environment, multiple IoT applications will not cause illegal access when accessing the same IoT terminal.
在本发明实施例中,步骤S102中,对所述第一会话指令进行解析后创建解析后第一会话指令的平台逻辑会话节点,包括:In the embodiment of the present invention, in step S102, the platform logical session node that parses the first session instruction after parsing the first session instruction includes:
根据所述第一会话指令中携带的所述物联网终端标识在物联网终端列表中查找与所述物联网终端标识对应的当前物联网终端是否已存在会话;Determining, according to the Internet of Things terminal identifier carried in the first session instruction, whether a current Internet of Things terminal corresponding to the IoT terminal identifier exists in the Internet of Things terminal list;
若当前物联网终端不存在会话,在所述物联网终端列表中新增一个节点存放与当前物联网终端对应的平台会话链表的首节点地址,并创建所述平台逻辑会话节点;If there is no session in the current Internet of Things terminal, a node is added to the list of the Internet of Things terminals to store the first node address of the platform session linked list corresponding to the current Internet of Things terminal, and the platform logical session node is created;
若当前物联网终端存在会话,根据当前物联网终端节点包含的平台会话链表的首节点地址按照优先级查找对应平台会话链表,将解析后第一会话指 令放在同级优先级的会话最后。If there is a session in the current IoT terminal, according to the first node address of the platform session list included in the current IoT terminal node, the corresponding platform session list is searched according to the priority, and the first session refers to the parsed Order the session at the same level as the priority.
如图2所示,物联网终端列表是由物联网终端组织,列表节点包含物联网终端标识和对应的平台会话链表的首节点地址。首先获取物联网终端标识,根据物联网终端标识在物联网终端列表中查找与物联网终端标识对应的当前物联网终端是否已存在会话。如果当前物联网终端不存在会话,则需要在物联网终端列表中新增一个节点,用于存放与当前物联网终端对应的平台会话链表的首节点地址,同时在对应的平台会话链表中创建保存会话的平台逻辑会话节点。如果当前物联网终端存在会话,则根据当前物联网终端节点包含的平台会话链表的首节点地址按照优先级查找对应平台会话链表,将解析后第一会话指令放在同级优先级的会话最后。As shown in FIG. 2, the Internet of Things terminal list is organized by the Internet of Things terminal, and the list node includes the IoT terminal identifier and the first node address of the corresponding platform session linked list. First, the identifier of the Internet of Things terminal is obtained, and according to the identifier of the Internet of Things terminal, the Internet of Things terminal list is searched for whether the current Internet of Things terminal corresponding to the IoT terminal identifier already has a session. If there is no session in the current IoT terminal, a node is added to the IoT terminal list to store the first node address of the platform session list corresponding to the current IoT terminal, and the save is created in the corresponding platform session list. The platform logical session node for the session. If there is a session in the current IoT terminal, the corresponding platform session list is searched according to the priority according to the first node address of the platform session list included in the current IoT terminal node, and the parsed first session instruction is placed at the end of the session of the same priority.
提取第一会话指令中的会话属性,若当前物联网终端存在会话,且会话属性为共享方式时,将解析后第一会话指令合并到同级优先级且资源标识相同的会话中。The session attribute in the first session instruction is extracted. If the current IoT terminal has a session and the session attribute is in the shared mode, the parsed first session instruction is merged into the session with the same priority and the same resource identifier.
在本发明实施例中,所述方法还包括:In the embodiment of the present invention, the method further includes:
接收所述物联网应用发送的携带所述逻辑会话标识的终止会话指令;Receiving, by the IoT application, a termination session instruction carrying the logical session identifier;
将所述终止会话指令发送至所述物联网终端,由所述物联网终端删除与所述物联网平台建立会话连接时生成的终端逻辑会话节点;Transmitting the termination session instruction to the Internet of Things terminal, and deleting, by the IoT terminal, a terminal logical session node generated when a session connection is established with the Internet of Things platform;
接收所述物联网终端发送的携带所述逻辑会话标识的会话终止成功消息,并删除所述平台逻辑会话节点;Receiving a session termination success message sent by the IoT terminal carrying the logical session identifier, and deleting the platform logical session node;
向所述物联网应用返回携带所述逻辑会话标识的会话终止成功消息,由所述物联网应用删除发起所述第一会话指令时生成的应用逻辑会话节点,终止会话。Returning, to the IoT application, a session termination success message carrying the logical session identifier, and deleting, by the IoT application, an application logical session node generated when the first session instruction is initiated, and terminating the session.
其中,接收物联网应用发送的携带逻辑会话标识的终止会话指令,将携带逻辑会话标识的终止会话指令转发至物联网终端,使得物联网终端根据终止会话指令删除终端逻辑会话节点,其中终端逻辑会话节点是物联网终端与物联网平台建立会话连接时生成的。接收物联网终端在删除终端逻辑会话节点后发送的携带逻辑会话标识的会话终止成功消息,并根据会话终止成功消息,删除平台逻辑会话节点。并向物联网应用返回携带逻辑会话标识的会话 终止成功消息,使得物联网应用删除应用逻辑会话节点,终止会话,其中应用逻辑会话节点是物联网应用发起第一会话指令时生成的。The termination session instruction that carries the logical session identifier sent by the Internet of Things application forwards the termination session instruction carrying the logical session identifier to the Internet of Things terminal, so that the Internet of Things terminal deletes the terminal logical session node according to the termination session instruction, where the terminal logical session A node is generated when an IoT terminal establishes a session connection with an IoT platform. Receiving a session termination success message sent by the IoT terminal carrying the logical session identifier after deleting the terminal logical session node, and deleting the platform logical session node according to the session termination success message. And return a session carrying the logical session ID to the IoT application Terminating the success message causes the IoT application to delete the application logical session node and terminate the session, wherein the application logical session node is generated when the IoT application initiates the first session instruction.
本发明实施例还提供一种无状态网络协议中实现有状态操作的方法,应用于物联网应用,如图3所示,所述方法包括以下步骤:The embodiment of the present invention further provides a method for implementing stateful operation in a stateless network protocol, which is applied to an Internet of Things application. As shown in FIG. 3, the method includes the following steps:
步骤S201、向物联网平台发起包括第一物理会话标识的第一会话指令,由所述物联网平台对接收到的所述第一会话指令进行解析并创建解析后第一会话指令的平台逻辑会话节点后,与物联网终端之间建立会话连接;Step S201, initiating a first session instruction including a first physical session identifier to the Internet of Things platform, parsing the received first session instruction by the Internet of Things platform, and creating a platform logical session of the first session instruction after parsing After the node, establish a session connection with the Internet of Things terminal;
步骤S202、接收所述物联网平台与所述物联网终端建立会话连接且生成逻辑会话标识后发送的包含所述逻辑会话标识的逻辑会话建立成功消息,解析获得所述逻辑会话标识并保存,向所述物联网平台反馈连接成功消息。Step S202, receiving a logical session establishment success message that is sent by the Internet of Things platform and establishing the session connection with the Internet of Things terminal, and generating the logical session identifier, and the logical session establishment success message is obtained, and the logical session identifier is obtained and saved. The Internet of Things platform feeds back a connection success message.
物联网应用是运行在用户终端上的软件,本发明实施例中,用户终端也有一个会话管理的软件单元,用于发起/终止会话。当物联网应用需要发起会话时,调用会话管理提供的接口,因此,会话管理单元可服务于用户终端上的多个物联网应用,一个物联网终端可以运行多个物联网应用。The Internet of Things application is software running on the user terminal. In the embodiment of the present invention, the user terminal also has a session management software unit for initiating/terminating the session. When the IoT application needs to initiate a session, the interface provided by the session management is invoked. Therefore, the session management unit can serve multiple IoT applications on the user terminal, and one IoT terminal can run multiple IoT applications.
物联网应用首先向物联网平台发送包括第一物理会话标识的第一会话指令,在发送第一会话指令的同时生成应用逻辑会话节点,使得物联网平台在接收到第一会话指令后,对第一会话指令进行解析,获取第一会话指令中携带的物联网终端标识和会话属性,然后根据物联网终端标识查找到对应的平台会话链表。需要说明的是,多个物联网终端组成物联网终端列表,物联网终端列表中的一个列表节点代表一个物联网终端,列表节点包含物联网终端标识和对应的平台会话链表的首节点地址。在平台会话链表下创建解析后第一会话指令的平台逻辑会话节点。然后由物联网平台建立与物联网终端之间的会话连接。The IoT application first sends a first session instruction including the first physical session identifier to the Internet of Things platform, and generates an application logical session node while sending the first session instruction, so that the Internet of Things platform receives the first session instruction, A session instruction parses, obtains an IoT terminal identifier and a session attribute carried in the first session instruction, and then finds a corresponding platform session linked list according to the IoT terminal identifier. It should be noted that a plurality of IoT terminals constitute an IoT terminal list, and a list node in the IoT terminal list represents an IoT terminal, and the list node includes an IoT terminal identifier and a corresponding node node linked list first node address. A platform logical session node that resolves the first session instruction is created under the platform session list. The session connection between the IoT terminal and the IoT terminal is then established by the IoT platform.
接收物联网平台与物联网终端建立会话连接且生成逻辑会话标识后发送的逻辑会话建立成功消息,其中逻辑会话建立成功消息中包含逻辑会话标识。从接收到的逻辑会话建立成功消息中提取逻辑会话标识并保存,向物联网平台反馈连接成功消息,完成物联网应用与物联网终端之间的逻辑会话的建立。Receiving a logical session establishment success message sent after the IoT platform establishes a session connection with the IoT terminal and generates a logical session identifier, where the logical session establishment success message includes a logical session identifier. The logical session identifier is extracted and saved from the received logical session establishment success message, and the connection success message is fed back to the Internet of Things platform to complete the establishment of the logical session between the Internet of Things application and the Internet of Things terminal.
在本发明实施例中,所述方法还包括: In the embodiment of the present invention, the method further includes:
向所述物联网平台发送携带所述逻辑会话标识的终止会话指令,由所述物联网平台将所述终止会话指令发送至所述物联网终端,并接收所述物联网终端在删除与所述物联网平台建立会话连接时生成的终端逻辑会话节点后返回的会话终止成功消息;Sending a termination session instruction carrying the logical session identifier to the Internet of Things platform, the termination session instruction is sent by the IoT platform to the Internet of Things terminal, and receiving the IoT terminal is deleted and The session termination success message returned after the terminal logical session node is generated when the Internet of Things platform establishes a session connection;
接收经所述物联网平台在删除所述平台逻辑会话节点后转发的所述会话终止成功消息,删除所述应用逻辑会话节点,终止会话。Receiving the session termination success message forwarded by the IoT platform after deleting the platform logical session node, deleting the application logical session node, and terminating the session.
其中,当终止会话时,向物联网平台发送携带逻辑会话标识的终止会话指令,使得物联网平台在接收到终止会话指令后将终止会话指令发送至物联网终端,由物联网终端根据终止会话指令删除终端逻辑会话节点,其中终端逻辑会话节点是物联网终端与物联网平台建立会话连接时生成的,向物联网平台发送会话终止成功消息,由物联网平台在删除平台逻辑会话节点后转发会话终止成功消息,接收物联网平台发送的会话终止成功消息,并根据会话终止成功消息删除应用逻辑会话节点,终止会话过程。When the session is terminated, the terminating session instruction carrying the logical session identifier is sent to the Internet of Things platform, so that the IoT platform sends the terminating session command to the Internet of Things terminal after receiving the terminating session command, and the IoT terminal terminates the session command according to the termination session command. Deleting a terminal logical session node, where the terminal logical session node is generated when the IoT terminal establishes a session connection with the Internet of Things platform, and sends a session termination success message to the Internet of Things platform, and the IoT platform terminates the session termination after deleting the platform logical session node. The success message receives the session termination success message sent by the Internet of Things platform, and deletes the application logical session node according to the session termination success message, and terminates the session process.
本发明实施例还提供一种无状态网络协议中实现有状态操作的方法,应用于物联网终端,如图4所示,所述方法包括以下步骤:The embodiment of the present invention further provides a method for implementing stateful operation in a stateless network protocol, which is applied to an Internet of Things terminal. As shown in FIG. 4, the method includes the following steps:
步骤S301、接收物联网平台发送的第二会话指令,其中,所述第二会话指令为所述物联网平台创建平台逻辑会话节点且获取与物联网应用之间的第一物理会话标识后发送的;Step S301: Receive a second session instruction sent by the Internet of Things platform, where the second session instruction is sent after the first logical session node is created by the IoT platform and the first physical session identifier is obtained between the IoT application and the IoT application. ;
步骤S302、与所述物联网平台之间建立会话连接,向所述物联网平台返回会话建立消息,由所述物联网平台生成使所述物联网应用与所述物联网终端之间进行逻辑会话的逻辑会话标识;Step S302, establishing a session connection with the Internet of Things platform, returning a session establishment message to the Internet of Things platform, and generating, by the IoT platform, a logical session between the Internet of Things application and the Internet of Things terminal Logical session identifier;
步骤S303、接收所述物联网平台发送的携带所述逻辑会话标识的逻辑会话建立成功消息,根据所述逻辑会话标识与所述物联网应用完成消息的传递。Step S303: Receive a logical session establishment success message that is sent by the Internet of Things platform and carry the logical session identifier, and complete the delivery of the message according to the logical session identifier and the Internet of Things application.
其中,在物联网平台接收第一会话指令且对第一会话指令解析完成,创建解析后第一会话指令的平台逻辑会话节点,将平台逻辑会话节点进行存储且获取第一物理会话标识后,由物联网平台向物联网终端发送第二会话指令,物联网终端接收物联网平台发送的第二会话指令,与物联网平台之间建立会话连接,向物联网平台返回会话建立消息。 The platform logical session node that is configured to receive the first session instruction and the first session instruction is completed, and the platform logical session node of the first session instruction is configured to be stored, and after acquiring the first physical session identifier, The Internet of Things platform sends a second session instruction to the Internet of Things terminal, and the Internet of Things terminal receives the second session instruction sent by the Internet of Things platform, establishes a session connection with the Internet of Things platform, and returns a session establishment message to the Internet of Things platform.
物联网终端接收物联网平台发送的逻辑会话建立成功消息,其中逻辑会话建立成功消息中携带有物联网平台在接收到会话建立消息后,根据物联网终端返回的第二物理会话标识和与物联网应用之间的第一物理会话标识生成的逻辑会话标识,根据逻辑会话标识与物联网应用完成消息的传递。The IoT terminal receives the logical session establishment success message sent by the Internet of Things platform, wherein the logical session establishment success message carries the second physical session identifier returned by the Internet of Things terminal and the Internet of Things after the IoT platform receives the session establishment message. The first physical session between the applications identifies the generated logical session identifier, according to the logical session identifier and the delivery of the IoT application completion message.
在本发明实施例中,在接收物联网平台发送的第二会话指令后,所述方法还包括:In the embodiment of the present invention, after receiving the second session instruction sent by the Internet of Things platform, the method further includes:
生成终端逻辑会话节点;Generating a terminal logical session node;
提取所述第二会话指令中携带的会话属性,并保存。Extracting the session attribute carried in the second session instruction and saving.
其中,在接收物联网平台发送的第二会话指令后,根据第二会话指令生成终端逻辑会话节点,保存和设置本次逻辑会话属性,并向物联网平台返回会话建立消息。After receiving the second session instruction sent by the Internet of Things platform, the terminal logical session node is generated according to the second session instruction, the current logical session attribute is saved and set, and the session establishment message is returned to the Internet of Things platform.
在本发明实施例中,所述方法还包括:In the embodiment of the present invention, the method further includes:
接收由所述物联网应用发送经所述物联网平台转发的携带所述逻辑会话标识的终止会话指令;Receiving, by the IoT application, sending a termination session instruction that is forwarded by the Internet of Things platform and carrying the logical session identifier;
根据所述终止会话指令,删除所述终端逻辑会话节点;Deleting the terminal logical session node according to the terminating session instruction;
向所述物联网平台发送携带所述逻辑会话标识的会话终止成功消息,由所述物联网平台删除所述平台逻辑会话节点后向所述物联网应用返回携带所述逻辑会话标识的会话终止成功消息,由所述物联网应用删除应用逻辑会话节点,终止会话。Sending a session termination success message carrying the logical session identifier to the Internet of Things platform, and deleting, by the Internet of Things platform, the platform logical session node, returning to the IoT application, the session carrying the logical session identifier is successfully terminated. The message is deleted by the IoT application to terminate the session.
其中,接收经物联网平台转发的由物联网应用发送的终止会话指令,其中终止会话指令中携带有逻辑会话标识,根据携带逻辑会话标识的终止会话指令,删除终端逻辑会话节点;然后向物联网平台发送携带逻辑会话标识的会话终止成功消息,物联网平台根据会话终止成功消息删除平台逻辑会话节点后向物联网应用返回携带逻辑会话标识的会话终止成功消息,物联网应用根据会话终止成功消息删除应用逻辑会话节点,终止整个会话流程。The terminating session instruction sent by the Internet of Things application is forwarded by the IoT platform, wherein the terminating session instruction carries a logical session identifier, and the terminal logical session node is deleted according to the termination session instruction carrying the logical session identifier; and then the Internet of Things is sent to the Internet of Things. The platform sends a session termination success message carrying the logical session identifier, and the IoT platform deletes the platform logical session node according to the session termination success message and returns a session termination success message carrying the logical session identifier to the IoT application, and the IoT application deletes according to the session termination success message. Apply the logical session node to terminate the entire session process.
如图5所示,本发明实施例的逻辑会话建立的整体流程包括以下步骤:As shown in FIG. 5, the overall process of establishing a logical session in the embodiment of the present invention includes the following steps:
步骤S401、物联网应用向物联网平台发送第一会话指令。Step S401: The Internet of Things application sends a first session instruction to the Internet of Things platform.
步骤S402、物联网平台接收第一会话指令,根据第一会话指令生成平台 逻辑会话节点。Step S402, the Internet of Things platform receives the first session instruction, and generates a platform according to the first session instruction. Logical session node.
步骤S403、物联网平台向物联网终端发起第二会话指令。Step S403: The Internet of Things platform initiates a second session instruction to the Internet of Things terminal.
步骤S404、物联网终端接收第二会话指令,生成终端逻辑会话节点。Step S404: The Internet of Things terminal receives the second session instruction, and generates a terminal logical session node.
步骤S405、物联网终端向物联网平台发送会话建立消息。Step S405: The Internet of Things terminal sends a session establishment message to the Internet of Things platform.
步骤S406、物联网平台生成逻辑会话标识后,向物联网应用和物联网终端发送逻辑会话建立成功消息。Step S406: After the IoT platform generates the logical session identifier, send a logical session establishment success message to the Internet of Things application and the Internet of Things terminal.
步骤S407、物联网应用和物联网终端向物联网平台反馈连接成功消息。Step S407, the Internet of Things application and the Internet of Things terminal feed back a connection success message to the Internet of Things platform.
在逻辑会话建立成功后,需要进行消息的传递,如图6所示,该过程包括以下步骤:After the logical session is successfully established, the message needs to be delivered. As shown in FIG. 6, the process includes the following steps:
步骤S501、物联网应用发送第一指令消息,消息中包含逻辑会话标识。Step S501: The Internet of Things application sends a first instruction message, where the message includes a logical session identifier.
步骤S502、物联网平台收到第一指令消息,解析第一指令消息并创建平台逻辑会话节点,获取逻辑会话标识,保存第一指令消息。Step S502: The Internet of Things platform receives the first instruction message, parses the first instruction message, creates a platform logical session node, acquires a logical session identifier, and saves the first instruction message.
步骤S503、物联网平台发送第二指令消息,发给本次逻辑会话的物联网终端,消息中包含逻辑会话标识。Step S503: The Internet of Things platform sends a second instruction message to the Internet of Things terminal of the logical session, where the message includes a logical session identifier.
步骤S504、物联网终端收到第二指令消息,生成终端逻辑会话节点,保存第二指令消息,根据执行策略执行指令,生成执行结果。Step S504: The IoT terminal receives the second instruction message, generates a terminal logical session node, saves the second instruction message, and generates an execution result according to the execution policy execution instruction.
步骤S505、物联网终端向物联网平台返回响应消息,消息中包含逻辑会话标识。Step S505: The Internet of Things terminal returns a response message to the Internet of Things platform, where the message includes a logical session identifier.
步骤S506、物联网平台收到物联网终端返回的响应消息,解析并获取逻辑会话标识,生成平台逻辑会话节点,保存响应消息。Step S506: The Internet of Things platform receives the response message returned by the Internet of Things terminal, parses and acquires the logical session identifier, generates a platform logical session node, and saves the response message.
步骤S507、物联网平台向物联网应用返回响应消息,其中,响应消息中包含了逻辑会话标识。Step S507: The Internet of Things platform returns a response message to the Internet of Things application, where the response message includes a logical session identifier.
步骤S508、物联网应用收到响应消息,解析并获取执行结果,保存响应消息。Step S508: The Internet of Things application receives the response message, parses and obtains the execution result, and saves the response message.
在消息交互完成后,进行终止会话流程,如图7所示,该流程包括以下步骤:After the message interaction is completed, the session termination process is performed. As shown in FIG. 7, the process includes the following steps:
步骤S601、物联网应用发起终止会话指令,消息中包含逻辑会话标识。 Step S601: The Internet of Things application initiates a termination session instruction, and the message includes a logical session identifier.
步骤S602、物联网平台转发终止会话指令。Step S602: The Internet of Things platform forwards the termination session instruction.
步骤S603、物联网终端收到终止会话指令,删除终端逻辑会话节点。Step S603: The Internet of Things terminal receives the termination session instruction, and deletes the terminal logical session node.
步骤S604、物联网终端向物联网平台返回会话终止成功消息,消息中包含逻辑会话标识。Step S604: The Internet of Things terminal returns a session termination success message to the Internet of Things platform, where the message includes a logical session identifier.
步骤S605、物联网平台删除平台逻辑会话节点。Step S605: The Internet of Things platform deletes the platform logical session node.
步骤S606、物联网平台向物联网应用返回会话终止成功消息,消息中包含逻辑会话标识。Step S606: The Internet of Things platform returns a session termination success message to the Internet of Things application, where the message includes a logical session identifier.
步骤S607、物联网应用收到会话终止成功消息,删除应用逻辑会话节点。Step S607: The Internet of Things application receives the session termination success message, and deletes the application logical session node.
如图8所示,本发明实施例还提供一种无状态网络协议中实现有状态操作的装置,应用于物联网平台,所述装置包括:As shown in FIG. 8, the embodiment of the present invention further provides a device for implementing stateful operation in a stateless network protocol, which is applied to an Internet of Things platform, and the device includes:
第一接收模块,设置为接收物联网应用发起的第一会话指令,其中,所述第一会话指令为包括第一物理会话标识的逻辑会话指令;a first receiving module, configured to receive a first session instruction initiated by the Internet of Things application, where the first session instruction is a logical session instruction including a first physical session identifier;
创建处理模块,设置为对所述第一会话指令进行解析后创建解析后第一会话指令的平台逻辑会话节点,将所述平台逻辑会话节点根据优先级存放到所述第一会话指令携带的物联网终端标识对应的平台会话链表中;a processing processing module, configured to: after the parsing the first session instruction, create a platform logical session node of the parsed first session instruction, and store the platform logical session node according to the priority to the object carried by the first session instruction The platform session list corresponding to the networked terminal identifier;
建立生成模块,设置为与所述第一会话指令携带的物联网终端标识对应的物联网终端之间建立会话连接,生成使所述物联网应用与所述物联网终端之间进行逻辑会话的逻辑会话标识;Establishing a generation module, configured to establish a session connection between the Internet of Things terminals corresponding to the IoT terminal identifier carried by the first session instruction, and generate logic for performing a logical session between the Internet of Things application and the Internet of Things terminal Session identifier
第一返回模块,设置为向所述物联网应用与所述物联网终端返回携带所述逻辑会话标识的逻辑会话建立成功消息,使所述物联网应用与所述物联网终端通过所述逻辑会话标识完成消息的传递。a first returning module, configured to return a logical session establishment success message carrying the logical session identifier to the Internet of Things application and the Internet of Things terminal, to enable the Internet of Things application and the Internet of Things terminal to pass the logical session Identifies the delivery of the completion message.
在本发明实施例中,所述建立生成模块包括:In the embodiment of the present invention, the establishing the generating module includes:
发送子模块,设置为向所述物联网终端发送第二会话指令;a sending submodule, configured to send a second session instruction to the Internet of Things terminal;
第一接收子模块,设置为接收所述物联网终端接收所述第二会话指令生成终端逻辑会话节点后返回的会话建立消息。The first receiving submodule is configured to receive a session establishment message returned after the IoT terminal receives the second session instruction to generate a logical session node of the terminal.
在本发明实施例中,所述建立生成模块还包括:In the embodiment of the present invention, the establishing the generating module further includes:
获取子模块,设置为创建解析后第一会话指令的平台逻辑会话节点后, 获取所述第一物理会话标识;Obtaining a submodule, set to create a platform logical session node of the first session instruction after parsing, Obtaining the first physical session identifier;
第二接收子模块,设置为与所述物联网终端之间建立会话连接,接收所述物联网终端返回的第二物理会话标识;a second receiving sub-module, configured to establish a session connection with the Internet of Things terminal, and receive a second physical session identifier returned by the Internet of Things terminal;
生成子模块,设置为根据所述第一物理会话标识和所述第二物理会话标识生成所述逻辑会话标识。Generating a submodule, configured to generate the logical session identifier according to the first physical session identifier and the second physical session identifier.
在本发明实施例中,所述创建处理模块还设置为:获取所述第一会话指令中携带的物联网终端标识和会话属性。In the embodiment of the present invention, the creation processing module is further configured to: acquire an IoT terminal identifier and a session attribute carried in the first session instruction.
在本发明实施例中,所述创建处理模块包括:In the embodiment of the present invention, the creating a processing module includes:
查找子模块,设置为根据所述第一会话指令中携带的所述物联网终端标识在物联网终端列表中查找与所述物联网终端标识对应的当前物联网终端是否已存在会话;a locating sub-module, configured to search, in the IoT terminal list, whether the current IoT terminal corresponding to the IoT terminal identifier has a session according to the IoT terminal identifier carried in the first session instruction;
处理子模块,设置为:若当前物联网终端不存在会话,在所述物联网终端列表中新增一个节点存放与当前物联网终端对应的平台会话链表的首节点地址,并创建所述平台逻辑会话节点;若当前物联网终端存在会话,根据当前物联网终端节点包含的平台会话链表的首节点地址按照优先级查找对应平台会话链表,将解析后第一会话指令放在同级优先级的会话最后。The processing submodule is configured to: if the current IoT terminal does not have a session, add a node in the IoT terminal list to store the first node address of the platform session linked list corresponding to the current IoT terminal, and create the platform logic a session node; if there is a session in the current IoT terminal, according to the first node address of the platform session list included in the current IoT terminal node, the corresponding platform session list is searched according to the priority, and the parsed first session instruction is placed in the session of the same priority At last.
在本发明实施例中,所述处理子模块还设置为:若当前物联网终端存在会话,且会话属性为共享方式时,将解析后第一会话指令合并到同级优先级且资源标识相同的会话中。In the embodiment of the present invention, the processing sub-module is further configured to: if the current IoT terminal has a session, and the session attribute is the shared mode, the first session instruction after parsing is merged into the same-level priority and the resource identifier is the same. In the conversation.
在本发明实施例中,所述装置还包括:In the embodiment of the present invention, the device further includes:
第二接收模块,设置为接收所述物联网应用发送的携带所述逻辑会话标识的终止会话指令;a second receiving module, configured to receive a termination session command that is sent by the Internet of Things application and that carries the logical session identifier;
第一发送模块,设置为将所述终止会话指令发送至所述物联网终端,其中,由所述物联网终端删除与所述物联网平台建立会话连接时生成的终端逻辑会话节点;a first sending module, configured to send the termination session instruction to the Internet of Things terminal, where the terminal logical session node generated when establishing a session connection with the Internet of Things platform is deleted by the Internet of Things terminal;
第三接收模块,设置为接收所述物联网终端发送的携带所述逻辑会话标识的会话终止成功消息,并删除所述平台逻辑会话节点;a third receiving module, configured to receive a session termination success message sent by the Internet of Things terminal that carries the logical session identifier, and delete the platform logical session node;
第二返回模块,设置为向所述物联网应用返回携带所述逻辑会话标识的 会话终止成功消息,其中,由所述物联网应用删除发起所述第一会话指令时生成的应用逻辑会话节点,终止会话。a second returning module, configured to return to the IoT application to carry the logical session identifier a session termination success message, wherein the application logical session node generated when the first session instruction is initiated is deleted by the IoT application, and the session is terminated.
如图9所示,本发明实施例还提供一种无状态网络协议中实现有状态操作的装置,应用于物联网应用,所述装置包括:As shown in FIG. 9, the embodiment of the present invention further provides a device for implementing stateful operation in a stateless network protocol, which is applied to an Internet of Things application, and the device includes:
发起模块,设置为向物联网平台发起包括第一物理会话标识的第一会话指令,其中,由所述物联网平台对接收到的所述第一会话指令进行解析并创建解析后第一会话指令的平台逻辑会话节点后,与物联网终端之间建立会话连接;The initiating module is configured to initiate a first session instruction including the first physical session identifier to the Internet of Things platform, where the first session instruction received by the Internet of Things platform is parsed and the parsed first session instruction is created After the platform logical session node, establish a session connection with the Internet of Things terminal;
处理模块,设置为接收所述物联网平台与所述物联网终端建立会话连接且生成逻辑会话标识后发送的包含所述逻辑会话标识的逻辑会话建立成功消息,解析获得所述逻辑会话标识并保存,向所述物联网平台反馈连接成功消息。a processing module, configured to receive a logical session establishment success message including the logical session identifier sent after the IoT platform establishes a session connection with the Internet of Things terminal, and generates a logical session identifier, and obtains the logical session identifier and saves And feeding back the connection success message to the Internet of Things platform.
在本发明实施例中,所述第一会话指令中携带有物联网终端标识和会话属性。In the embodiment of the present invention, the first session instruction carries an Internet of Things terminal identifier and a session attribute.
在本发明实施例中,所述发起模块还设置为:生成应用逻辑会话节点。In the embodiment of the present invention, the initiating module is further configured to: generate an application logical session node.
在本发明实施例中,所述装置还包括:In the embodiment of the present invention, the device further includes:
第二发送模块,设置为向所述物联网平台发送携带所述逻辑会话标识的终止会话指令,其中,由所述物联网平台将所述终止会话指令发送至所述物联网终端,并接收所述物联网终端在删除与所述物联网平台建立会话连接时生成的终端逻辑会话节点后返回的会话终止成功消息;a second sending module, configured to send a termination session instruction carrying the logical session identifier to the Internet of Things platform, where the termination session command is sent by the Internet of Things platform to the Internet of Things terminal, and the receiving Determining a session termination success message returned by the Internet of Things terminal after deleting the terminal logical session node generated when the session connection is established with the Internet of Things platform;
第一接收处理模块,设置为接收经所述物联网平台在删除所述平台逻辑会话节点后转发的所述会话终止成功消息,删除所述应用逻辑会话节点,终止会话。The first receiving processing module is configured to receive the session termination success message forwarded by the IoT platform after deleting the platform logical session node, delete the application logical session node, and terminate the session.
如图10所示,本发明实施例还提供一种无状态网络协议中实现有状态操作的装置,应用于物联网终端,所述装置包括:As shown in FIG. 10, an embodiment of the present invention further provides a device for implementing stateful operation in a stateless network protocol, which is applied to an Internet of Things terminal, and the device includes:
第四接收模块,设置为接收物联网平台发送的第二会话指令,其中,所述第二会话指令为所述物联网平台创建平台逻辑会话节点且获取与物联网应用之间的第一物理会话标识后发送的; a fourth receiving module, configured to receive a second session instruction sent by the Internet of Things platform, where the second session instruction creates a platform logical session node for the IoT platform and acquires a first physical session with the Internet of Things application Sent after the identification;
建立返回模块,设置为与所述物联网平台之间建立会话连接,向所述物联网平台返回会话建立消息,其中,由所述物联网平台生成使所述物联网应用与所述物联网终端之间进行逻辑会话的逻辑会话标识;Establishing a return module, configured to establish a session connection with the Internet of Things platform, and return a session establishment message to the Internet of Things platform, wherein the Internet of Things application and the Internet of Things terminal are generated by the Internet of Things platform a logical session identifier between logical sessions;
第二接收处理模块,设置为接收所述物联网平台发送的携带所述逻辑会话标识的逻辑会话建立成功消息,根据所述逻辑会话标识与所述物联网应用完成消息的传递。The second receiving processing module is configured to receive a logical session establishment success message that is sent by the Internet of Things platform and that carries the logical session identifier, and complete the delivery of the message according to the logical session identifier and the Internet of Things application.
在本实施例中,所述第四接收模块还设置为:生成终端逻辑会话节点,提取所述第二会话指令中携带的会话属性,并保存。In this embodiment, the fourth receiving module is further configured to: generate a terminal logical session node, extract the session attribute carried in the second session instruction, and save the session attribute.
在本实施例中,所述装置还包括:In this embodiment, the device further includes:
第五接收模块,设置为接收由所述物联网应用发送经所述物联网平台转发的携带所述逻辑会话标识的终止会话指令;a fifth receiving module, configured to receive, by the IoT application, a termination session instruction that is sent by the Internet of Things platform and that carries the logical session identifier;
删除模块,设置为根据所述终止会话指令,删除所述终端逻辑会话节点;Deleting a module, configured to delete the terminal logical session node according to the terminating session instruction;
第三发送模块,设置为向所述物联网平台发送携带所述逻辑会话标识的会话终止成功消息,其中,由所述物联网平台删除所述平台逻辑会话节点后向所述物联网应用返回携带所述逻辑会话标识的会话终止成功消息,由所述物联网应用删除应用逻辑会话节点,终止会话。a third sending module, configured to send a session termination success message carrying the logical session identifier to the Internet of Things platform, where the IoT platform deletes the platform logical session node and returns to the Internet of Things application The session termination success message identified by the logical session, the application logical session node is deleted by the Internet of Things application, and the session is terminated.
本发明实施例提供一种无状态网络协议中实现有状态操作的方法,通过物联网应用发起逻辑会话指令,物联网平台对逻辑会话指令进行解析后,创建平台逻辑会话节点进行存储;建立与相应物联网终端之间的会话连接,生成逻辑会话标识;向物联网应用和物联网终端发送携带逻辑会话标识的逻辑会话建立成功消息,形成物联网应用与物联网终端之间消息的传递,可以解决相关技术中会话传递时会话必须保持完整、会话分包丢失时由请求方重新发送以及多个发送端向同一接收端发送消息时无法操作的问题,实现物联网应用在无状态网络中对物联网终端进行有状态的操作。Embodiments of the present invention provide a method for implementing stateful operation in a stateless network protocol, which initiates a logical session instruction through an Internet of Things application, and after the Internet of Things platform parses the logical session instruction, creates a platform logical session node for storage; establishing and corresponding The session connection between the Internet of Things terminals generates a logical session identifier; sends a logical session establishment success message carrying the logical session identifier to the Internet of Things application and the Internet of Things terminal, and forms a message transmission between the Internet of Things application and the Internet of Things terminal, which can be solved In the related art, the session must be kept complete when the session is delivered, the requester is resent when the session is lost, and the problem cannot be operated when multiple senders send messages to the same receiver, so that the Internet of Things application in the stateless network is in the Internet of Things. The terminal performs stateful operations.
需要说明的是,本发明实施例提供的无状态网络协议中实现有状态操作的装置是应用上述方法的装置,则上述方法的所有实施例均适用于该装置,且均能达到相同或相似的有益效果。It should be noted that, in the stateless network protocol provided by the embodiment of the present invention, a device for implementing stateful operation is a device applying the foregoing method, and all embodiments of the foregoing method are applicable to the device, and both can achieve the same or similar Beneficial effect.
本发明实施例还提供一种计算机可读存储介质,存储有计算机可执行指 令,所述计算机可执行指令被执行时实现应用于物联网平台的上述无状态网络协议中实现有状态操作的方法。The embodiment of the invention further provides a computer readable storage medium, which stores a computer executable finger The method of implementing stateful operations in the above stateless network protocol applied to the Internet of Things platform is implemented when the computer executable instructions are executed.
本发明实施例还提供一种计算机可读存储介质,存储有计算机可执行指令,所述计算机可执行指令被执行时实现应用于物联网应用的上述无状态网络协议中实现有状态操作的方法。Embodiments of the present invention also provide a computer readable storage medium storing computer executable instructions that, when executed, implement a method for implementing stateful operations in the above stateless network protocol applied to an Internet of Things application.
本发明实施例还提供一种计算机可读存储介质,存储有计算机可执行指令,所述计算机可执行指令被执行时实现应用于物联网终端的上述无状态网络协议中实现有状态操作的方法。Embodiments of the present invention further provide a computer readable storage medium storing computer executable instructions, which when implemented, implement a method for implementing stateful operations in the above stateless network protocol applied to an Internet of Things terminal.
本领域普通技术人员可以理解上述方法中的全部或部分步骤可通过程序来指令相关硬件(例如处理器)完成,所述程序可以存储于计算机可读存储介质中,如只读存储器、磁盘或光盘等。可选地,上述实施例的全部或部分步骤也可以使用一个或多个集成电路来实现。相应地,上述实施例中的各模块/单元可以采用硬件的形式实现,例如通过集成电路来实现其相应功能,也可以采用软件功能模块的形式实现,例如通过处理器执行存储于存储器中的程序/指令来实现其相应功能。本申请实施例不限制于任何特定形式的硬件和软件的结合。One of ordinary skill in the art will appreciate that all or a portion of the above steps may be performed by a program to instruct related hardware, such as a processor, which may be stored in a computer readable storage medium, such as a read only memory, disk or optical disk. Wait. Alternatively, all or part of the steps of the above embodiments may also be implemented using one or more integrated circuits. Correspondingly, each module/unit in the above embodiment may be implemented in the form of hardware, for example, by implementing an integrated circuit to implement its corresponding function, or may be implemented in the form of a software function module, for example, executing a program stored in the memory by a processor. / instruction to achieve its corresponding function. The embodiments of the present application are not limited to any particular form of combination of hardware and software.
以上所述是本申请的可选实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本申请所述原理的前提下,还可以作出若干改进和润饰,这些改进和润饰也应视为本申请的保护范围。The above is an alternative embodiment of the present application, and it should be noted that those skilled in the art can also make several improvements and retouchings without departing from the principles of the present application. It should also be considered as the scope of protection of this application.
工业实用性Industrial applicability
本申请实施例提供一种无状态网络协议中实现有状态操作的方法及装置,可以解决相关技术中会话传递时会话必须保持完整、会话分包丢失时由请求方重新发送以及多个发送端向同一接收端发送消息时无法操作的问题,实现物联网应用在无状态网络中对物联网终端进行有状态的操作。 The embodiment of the present invention provides a method and an apparatus for implementing a stateful operation in a stateless network protocol, which can solve the problem that the session must be kept complete when the session is delivered, the session is resent, and the multiple senders are sent to the sender. The problem that the same receiving end cannot operate when sending a message enables the IoT application to perform stateful operations on the IoT terminal in a stateless network.

Claims (28)

  1. 一种无状态网络协议中实现有状态操作的方法,应用于物联网平台,所述方法包括:A method for implementing stateful operation in a stateless network protocol, applied to an Internet of Things platform, the method comprising:
    接收物联网应用发起的第一会话指令,其中,所述第一会话指令为包括第一物理会话标识的逻辑会话指令;Receiving a first session instruction initiated by the Internet of Things application, where the first session instruction is a logical session instruction including a first physical session identifier;
    对所述第一会话指令进行解析后创建解析后第一会话指令的平台逻辑会话节点,将所述平台逻辑会话节点根据优先级存放到所述第一会话指令携带的物联网终端标识对应的平台会话链表中;a platform logical session node that resolves the first session instruction and creates a parsed first session instruction, and stores the platform logical session node according to the priority to a platform corresponding to the IoT terminal identifier carried by the first session instruction In the conversation list;
    与所述第一会话指令携带的物联网终端标识对应的物联网终端之间建立会话连接,生成使所述物联网应用与所述物联网终端之间进行逻辑会话的逻辑会话标识;Establishing a session connection between the Internet of Things terminals corresponding to the IoT terminal identifier carried by the first session instruction, and generating a logical session identifier for performing a logical session between the Internet of Things application and the Internet of Things terminal;
    向所述物联网应用与所述物联网终端返回携带所述逻辑会话标识的逻辑会话建立成功消息,使所述物联网应用与所述物联网终端通过所述逻辑会话标识完成消息的传递。Returning, to the IoT application, the logical session establishment success message carrying the logical session identifier to the Internet of Things terminal, so that the Internet of Things application and the Internet of Things terminal complete the delivery of the message through the logical session identifier.
  2. 如权利要求1所述的方法,其中,所述与所述第一会话指令携带的物联网终端标识对应的物联网终端之间建立会话连接的步骤包括:The method of claim 1, wherein the step of establishing a session connection between the IoT terminal corresponding to the IoT terminal identifier carried by the first session instruction comprises:
    向所述物联网终端发送第二会话指令;Sending a second session instruction to the Internet of Things terminal;
    接收所述物联网终端接收所述第二会话指令生成终端逻辑会话节点后返回的会话建立消息。Receiving a session establishment message returned by the IoT terminal after receiving the second session instruction to generate a logical session node of the terminal.
  3. 如权利要求1所述的方法,其中,所述生成使所述物联网应用与所述物联网终端之间进行逻辑会话的逻辑会话标识,包括:The method of claim 1, wherein the generating a logical session identification that causes a logical session between the Internet of Things application and the Internet of Things terminal comprises:
    创建解析后第一会话指令的平台逻辑会话节点后,获取所述第一物理会话标识;After the platform logical session node of the first session instruction is parsed, the first physical session identifier is obtained;
    与所述物联网终端之间建立会话连接,接收所述物联网终端返回的第二物理会话标识;Establishing a session connection with the Internet of Things terminal, and receiving a second physical session identifier returned by the Internet of Things terminal;
    根据所述第一物理会话标识和所述第二物理会话标识生成所述逻辑会话标识。 Generating the logical session identifier according to the first physical session identifier and the second physical session identifier.
  4. 如权利要求1所述的方法,其中,所述对所述第一会话指令进行解析的步骤还包括:获取所述第一会话指令中携带的物联网终端标识和会话属性。The method of claim 1, wherein the step of parsing the first session instruction further comprises: obtaining an IoT terminal identifier and a session attribute carried in the first session instruction.
  5. 如权利要求4所述的方法,其中,所述对所述第一会话指令进行解析后创建解析后第一会话指令的平台逻辑会话节点,包括:The method of claim 4, wherein the parsing the first session instruction to create a platform logical session node of the parsed first session instruction comprises:
    根据所述第一会话指令中携带的所述物联网终端标识在物联网终端列表中查找与所述物联网终端标识对应的当前物联网终端是否已存在会话;Determining, according to the Internet of Things terminal identifier carried in the first session instruction, whether a current Internet of Things terminal corresponding to the IoT terminal identifier exists in the Internet of Things terminal list;
    若当前物联网终端不存在会话,在所述物联网终端列表中新增一个节点存放与当前物联网终端对应的平台会话链表的首节点地址,并创建所述平台逻辑会话节点;If there is no session in the current Internet of Things terminal, a node is added to the list of the Internet of Things terminals to store the first node address of the platform session linked list corresponding to the current Internet of Things terminal, and the platform logical session node is created;
    若当前物联网终端存在会话,根据当前物联网终端节点包含的平台会话链表的首节点地址按照优先级查找对应平台会话链表,将解析后第一会话指令放在同级优先级的会话最后。If there is a session in the current IoT terminal, the corresponding session session list is searched according to the priority of the first node address of the platform session list included in the current IoT terminal node, and the parsed first session instruction is placed at the end of the session of the same priority.
  6. 如权利要求5所述的方法,所述方法还包括:若当前物联网终端存在会话,且会话属性为共享方式时,将解析后第一会话指令合并到同级优先级且资源标识相同的会话中。The method of claim 5, the method further comprising: if the current IoT terminal has a session and the session attribute is a shared mode, merging the parsed first session instruction to a session with the same priority and the same resource identifier in.
  7. 如权利要求1所述的方法,所述方法还包括:The method of claim 1 further comprising:
    接收所述物联网应用发送的携带所述逻辑会话标识的终止会话指令;Receiving, by the IoT application, a termination session instruction carrying the logical session identifier;
    将所述终止会话指令发送至所述物联网终端,由所述物联网终端删除与所述物联网平台建立会话连接时生成的终端逻辑会话节点;Transmitting the termination session instruction to the Internet of Things terminal, and deleting, by the IoT terminal, a terminal logical session node generated when a session connection is established with the Internet of Things platform;
    接收所述物联网终端发送的携带所述逻辑会话标识的会话终止成功消息,并删除所述平台逻辑会话节点;Receiving a session termination success message sent by the IoT terminal carrying the logical session identifier, and deleting the platform logical session node;
    向所述物联网应用返回携带所述逻辑会话标识的会话终止成功消息,由所述物联网应用删除发起所述第一会话指令时生成的应用逻辑会话节点,终止会话。Returning, to the IoT application, a session termination success message carrying the logical session identifier, and deleting, by the IoT application, an application logical session node generated when the first session instruction is initiated, and terminating the session.
  8. 一种无状态网络协议中实现有状态操作的方法,应用于物联网应用,所述方法包括:A method for implementing stateful operation in a stateless network protocol, applied to an Internet of Things application, the method comprising:
    向物联网平台发起包括第一物理会话标识的第一会话指令,由所述物联 网平台对接收到的所述第一会话指令进行解析并创建解析后第一会话指令的平台逻辑会话节点后,与物联网终端之间建立会话连接;Initiating, by the IoT platform, a first session instruction including a first physical session identifier, by the object association After the network platform parses the received first session instruction and creates a platform logical session node of the parsed first session instruction, establishing a session connection with the Internet of Things terminal;
    接收所述物联网平台与所述物联网终端建立会话连接且生成逻辑会话标识后发送的包含所述逻辑会话标识的逻辑会话建立成功消息,解析获得所述逻辑会话标识并保存,向所述物联网平台反馈连接成功消息。Receiving a logical session establishment success message including the logical session identifier sent by the Internet of Things platform after establishing a session connection with the Internet of Things terminal and generating a logical session identifier, parsing and obtaining the logical session identifier, and saving, to the object The networking platform feeds back the connection success message.
  9. 如权利要求8所述的方法,其中,所述第一会话指令中携带有物联网终端标识和会话属性。The method of claim 8 wherein said first session instruction carries an IoT terminal identity and a session attribute.
  10. 如权利要求8所述的方法,所述向物联网平台发起第一会话指令时,所述方法还包括:生成应用逻辑会话节点。The method of claim 8, wherein when the first session instruction is initiated to the Internet of Things platform, the method further comprises: generating an application logical session node.
  11. 如权利要求10所述的方法,所述方法还包括:The method of claim 10, the method further comprising:
    向所述物联网平台发送携带所述逻辑会话标识的终止会话指令,由所述物联网平台将所述终止会话指令发送至所述物联网终端,并接收所述物联网终端在删除与所述物联网平台建立会话连接时生成的终端逻辑会话节点后返回的会话终止成功消息;Sending a termination session instruction carrying the logical session identifier to the Internet of Things platform, the termination session instruction is sent by the IoT platform to the Internet of Things terminal, and receiving the IoT terminal is deleted and The session termination success message returned after the terminal logical session node is generated when the Internet of Things platform establishes a session connection;
    接收经所述物联网平台在删除平台逻辑会话节点后转发的所述会话终止成功消息,删除所述应用逻辑会话节点,终止会话。Receiving the session termination success message forwarded by the IoT platform after deleting the platform logical session node, deleting the application logical session node, and terminating the session.
  12. 一种无状态网络协议中实现有状态操作的方法,应用于物联网终端,所述方法包括:A method for implementing stateful operation in a stateless network protocol is applied to an Internet of Things terminal, and the method includes:
    接收物联网平台发送的第二会话指令,其中,所述第二会话指令为所述物联网平台创建平台逻辑会话节点且获取与物联网应用之间的第一物理会话标识后发送的;Receiving a second session instruction sent by the Internet of Things platform, where the second session instruction is sent after the first logical session node is created by the IoT platform and the first physical session identifier is obtained between the IoT application;
    与所述物联网平台之间建立会话连接,向所述物联网平台返回会话建立消息,由所述物联网平台生成使所述物联网应用与所述物联网终端之间进行逻辑会话的逻辑会话标识;Establishing a session connection with the IoT platform, returning a session establishment message to the IoT platform, and generating, by the IoT platform, a logical session for performing a logical session between the IoT application and the IoT terminal Identification
    接收所述物联网平台发送的携带所述逻辑会话标识的逻辑会话建立成功消息,根据所述逻辑会话标识与所述物联网应用完成消息的传递。Receiving, by the IoT platform, a logical session establishment success message carrying the logical session identifier, and transmitting the message according to the logical session identifier and the Internet of Things application completion message.
  13. 如权利要求12所述的方法,所述接收物联网平台发送的第二会话指令后,所述方法还包括: The method of claim 12, after the receiving the second session instruction sent by the Internet of Things platform, the method further comprises:
    生成终端逻辑会话节点;Generating a terminal logical session node;
    提取所述第二会话指令中携带的会话属性,并保存。Extracting the session attribute carried in the second session instruction and saving.
  14. 如权利要求13所述的方法,所述方法还包括:The method of claim 13 further comprising:
    接收由所述物联网应用发送经所述物联网平台转发的携带所述逻辑会话标识的终止会话指令;Receiving, by the IoT application, sending a termination session instruction that is forwarded by the Internet of Things platform and carrying the logical session identifier;
    根据所述终止会话指令,删除所述终端逻辑会话节点;Deleting the terminal logical session node according to the terminating session instruction;
    向所述物联网平台发送携带所述逻辑会话标识的会话终止成功消息,由所述物联网平台删除所述平台逻辑会话节点后向所述物联网应用返回携带所述逻辑会话标识的会话终止成功消息,由所述物联网应用删除应用逻辑会话节点,终止会话。Sending a session termination success message carrying the logical session identifier to the Internet of Things platform, and deleting, by the Internet of Things platform, the platform logical session node, returning to the IoT application, the session carrying the logical session identifier is successfully terminated. The message is deleted by the IoT application to terminate the session.
  15. 一种无状态网络协议中实现有状态操作的装置,应用于物联网平台,所述装置包括:A device for implementing stateful operation in a stateless network protocol is applied to an Internet of Things platform, and the device includes:
    第一接收模块,设置为接收物联网应用发起的第一会话指令,其中,所述第一会话指令为包括第一物理会话标识的逻辑会话指令;a first receiving module, configured to receive a first session instruction initiated by the Internet of Things application, where the first session instruction is a logical session instruction including a first physical session identifier;
    创建处理模块,设置为对所述第一会话指令进行解析后创建解析后第一会话指令的平台逻辑会话节点,将所述平台逻辑会话节点根据优先级存放到所述第一会话指令携带的物联网终端标识对应的平台会话链表中;a processing processing module, configured to: after the parsing the first session instruction, create a platform logical session node of the parsed first session instruction, and store the platform logical session node according to the priority to the object carried by the first session instruction The platform session list corresponding to the networked terminal identifier;
    建立生成模块,设置为与所述第一会话指令携带的物联网终端标识对应的物联网终端之间建立会话连接,生成使所述物联网应用与所述物联网终端之间进行逻辑会话的逻辑会话标识;Establishing a generation module, configured to establish a session connection between the Internet of Things terminals corresponding to the IoT terminal identifier carried by the first session instruction, and generate logic for performing a logical session between the Internet of Things application and the Internet of Things terminal Session identifier
    第一返回模块,设置为向所述物联网应用与所述物联网终端返回携带所述逻辑会话标识的逻辑会话建立成功消息,使所述物联网应用与所述物联网终端通过所述逻辑会话标识完成消息的传递。a first returning module, configured to return a logical session establishment success message carrying the logical session identifier to the Internet of Things application and the Internet of Things terminal, to enable the Internet of Things application and the Internet of Things terminal to pass the logical session Identifies the delivery of the completion message.
  16. 如权利要求15所述的装置,其中,所述建立生成模块包括:The apparatus of claim 15 wherein said establishing a generation module comprises:
    发送子模块,设置为向所述物联网终端发送第二会话指令;a sending submodule, configured to send a second session instruction to the Internet of Things terminal;
    第一接收子模块,设置为接收所述物联网终端接收所述第二会话指令生成终端逻辑会话节点后返回的会话建立消息。 The first receiving submodule is configured to receive a session establishment message returned after the IoT terminal receives the second session instruction to generate a logical session node of the terminal.
  17. 如权利要求15所述的装置,其中,所述建立生成模块包括:The apparatus of claim 15 wherein said establishing a generation module comprises:
    获取子模块,设置为创建解析后第一会话指令的平台逻辑会话节点后,获取所述第一物理会话标识;Obtaining the sub-module, and setting the first physical session identifier after setting the platform logical session node of the parsed first session instruction;
    第二接收子模块,设置为与所述物联网终端之间建立会话连接,接收所述物联网终端返回的第二物理会话标识;a second receiving sub-module, configured to establish a session connection with the Internet of Things terminal, and receive a second physical session identifier returned by the Internet of Things terminal;
    生成子模块,设置为根据所述第一物理会话标识和所述第二物理会话标识生成所述逻辑会话标识。Generating a submodule, configured to generate the logical session identifier according to the first physical session identifier and the second physical session identifier.
  18. 如权利要求15所述的装置,其中,所述创建处理模块还设置为:获取所述第一会话指令中携带的物联网终端标识和会话属性。The apparatus of claim 15, wherein the creation processing module is further configured to: acquire an IoT terminal identifier and a session attribute carried in the first session instruction.
  19. 如权利要求18所述的装置,其中,所述创建处理模块包括:The apparatus of claim 18, wherein the creation processing module comprises:
    查找子模块,设置为根据所述第一会话指令中携带的所述物联网终端标识在物联网终端列表中查找与所述物联网终端标识对应的当前物联网终端是否已存在会话;a locating sub-module, configured to search, in the IoT terminal list, whether the current IoT terminal corresponding to the IoT terminal identifier has a session according to the IoT terminal identifier carried in the first session instruction;
    处理子模块,设置为:若当前物联网终端不存在会话,在所述物联网终端列表中新增一个节点存放与当前物联网终端对应的平台会话链表的首节点地址,并创建所述平台逻辑会话节点;若当前物联网终端存在会话,根据当前物联网终端节点包含的平台会话链表的首节点地址按照优先级查找对应平台会话链表,将解析后第一会话指令放在同级优先级的会话最后。The processing submodule is configured to: if the current IoT terminal does not have a session, add a node in the IoT terminal list to store the first node address of the platform session linked list corresponding to the current IoT terminal, and create the platform logic a session node; if there is a session in the current IoT terminal, according to the first node address of the platform session list included in the current IoT terminal node, the corresponding platform session list is searched according to the priority, and the parsed first session instruction is placed in the session of the same priority At last.
  20. 如权利要求19所述的装置,其中,所述处理子模块还设置为:The apparatus of claim 19, wherein the processing sub-module is further configured to:
    若当前物联网终端存在会话,且会话属性为共享方式时,将解析后第一会话指令合并到同级优先级且资源标识相同的会话中。If the current IoT terminal has a session and the session attribute is the shared mode, the first session command is parsed into the session with the same priority and the same resource identifier.
  21. 如权利要求15所述的装置,所述装置还包括:The device of claim 15 further comprising:
    第二接收模块,设置为接收所述物联网应用发送的携带所述逻辑会话标识的终止会话指令;a second receiving module, configured to receive a termination session command that is sent by the Internet of Things application and that carries the logical session identifier;
    第一发送模块,设置为将所述终止会话指令发送至所述物联网终端,其中,由所述物联网终端删除与所述物联网平台建立会话连接时生成的终端逻辑会话节点; a first sending module, configured to send the termination session instruction to the Internet of Things terminal, where the terminal logical session node generated when establishing a session connection with the Internet of Things platform is deleted by the Internet of Things terminal;
    第三接收模块,设置为接收所述物联网终端发送的携带所述逻辑会话标识的会话终止成功消息,并删除所述平台逻辑会话节点;a third receiving module, configured to receive a session termination success message sent by the Internet of Things terminal that carries the logical session identifier, and delete the platform logical session node;
    第二返回模块,设置为向所述物联网应用返回携带所述逻辑会话标识的会话终止成功消息,其中,由所述物联网应用删除发起所述第一会话指令时生成的应用逻辑会话节点,终止会话。a second returning module, configured to return a session termination success message carrying the logical session identifier to the Internet of Things application, where the application logical session node generated when the first session instruction is initiated is deleted by the Internet of Things application, Terminate the session.
  22. 一种无状态网络协议中实现有状态操作的装置,应用于物联网应用,所述装置包括:A device for implementing stateful operation in a stateless network protocol is applied to an Internet of Things application, and the device includes:
    发起模块,设置为向物联网平台发起包括第一物理会话标识的第一会话指令,其中,由所述物联网平台对接收到的所述第一会话指令进行解析并创建解析后第一会话指令的平台逻辑会话节点后,与物联网终端之间建立会话连接;The initiating module is configured to initiate a first session instruction including the first physical session identifier to the Internet of Things platform, where the first session instruction received by the Internet of Things platform is parsed and the parsed first session instruction is created After the platform logical session node, establish a session connection with the Internet of Things terminal;
    处理模块,设置为接收所述物联网平台与所述物联网终端建立会话连接且生成逻辑会话标识后发送的包含所述逻辑会话标识的逻辑会话建立成功消息,解析获得所述逻辑会话标识并保存,向所述物联网平台反馈连接成功消息。a processing module, configured to receive a logical session establishment success message including the logical session identifier sent after the IoT platform establishes a session connection with the Internet of Things terminal, and generates a logical session identifier, and obtains the logical session identifier and saves And feeding back the connection success message to the Internet of Things platform.
  23. 如权利要求22所述的装置,其中,所述第一会话指令中携带有物联网终端标识和会话属性。The apparatus of claim 22, wherein the first session instruction carries an Internet of Things terminal identifier and a session attribute.
  24. 如权利要求22所述的装置,其中,所述发起模块还设置为:生成应用逻辑会话节点。The apparatus of claim 22 wherein the initiating module is further configured to generate an application logical session node.
  25. 如权利要求24所述的装置,所述装置还包括:The device of claim 24, the device further comprising:
    第二发送模块,设置为向所述物联网平台发送携带所述逻辑会话标识的终止会话指令,其中,由所述物联网平台将所述终止会话指令发送至所述物联网终端,并接收所述物联网终端在删除与所述物联网平台建立会话连接时生成的终端逻辑会话节点后返回的会话终止成功消息;a second sending module, configured to send a termination session instruction carrying the logical session identifier to the Internet of Things platform, where the termination session command is sent by the Internet of Things platform to the Internet of Things terminal, and the receiving Determining a session termination success message returned by the Internet of Things terminal after deleting the terminal logical session node generated when the session connection is established with the Internet of Things platform;
    第一接收处理模块,设置为接收经所述物联网平台在删除平台逻辑会话节点后转发的所述会话终止成功消息,删除所述应用逻辑会话节点,终止会话。The first receiving processing module is configured to receive the session termination success message forwarded by the IoT platform after deleting the platform logical session node, delete the application logical session node, and terminate the session.
  26. 一种无状态网络协议中实现有状态操作的装置,应用于物联网终端, 所述装置包括:A device for realizing stateful operation in a stateless network protocol, applied to an Internet of Things terminal, The device includes:
    第四接收模块,设置为接收物联网平台发送的第二会话指令,其中,所述第二会话指令为所述物联网平台创建平台逻辑会话节点且获取与物联网应用之间的第一物理会话标识后发送的;a fourth receiving module, configured to receive a second session instruction sent by the Internet of Things platform, where the second session instruction creates a platform logical session node for the IoT platform and acquires a first physical session with the Internet of Things application Sent after the identification;
    建立返回模块,设置为与所述物联网平台之间建立会话连接,向所述物联网平台返回会话建立消息,其中,由所述物联网平台生成使所述物联网应用与所述物联网终端之间进行逻辑会话的逻辑会话标识;Establishing a return module, configured to establish a session connection with the Internet of Things platform, and return a session establishment message to the Internet of Things platform, wherein the Internet of Things application and the Internet of Things terminal are generated by the Internet of Things platform a logical session identifier between logical sessions;
    第二接收处理模块,设置为接收所述物联网平台发送的携带所述逻辑会话标识的逻辑会话建立成功消息,根据所述逻辑会话标识与所述物联网应用完成消息的传递。The second receiving processing module is configured to receive a logical session establishment success message that is sent by the Internet of Things platform and that carries the logical session identifier, and complete the delivery of the message according to the logical session identifier and the Internet of Things application.
  27. 如权利要求26所述的装置,其中,所述第四接收模块还设置为:生成终端逻辑会话节点,提取所述第二会话指令中携带的会话属性,并保存。The apparatus of claim 26, wherein the fourth receiving module is further configured to: generate a terminal logical session node, extract session attributes carried in the second session instruction, and save the session attributes.
  28. 如权利要求27所述的装置,所述装置还包括:The apparatus of claim 27, the apparatus further comprising:
    第五接收模块,设置为接收由所述物联网应用发送经所述物联网平台转发的携带所述逻辑会话标识的终止会话指令;a fifth receiving module, configured to receive, by the IoT application, a termination session instruction that is sent by the Internet of Things platform and that carries the logical session identifier;
    删除模块,设置为根据所述终止会话指令,删除所述终端逻辑会话节点;Deleting a module, configured to delete the terminal logical session node according to the terminating session instruction;
    第三发送模块,设置为向所述物联网平台发送携带所述逻辑会话标识的会话终止成功消息,其中,由所述物联网平台删除所述平台逻辑会话节点后向所述物联网应用返回携带所述逻辑会话标识的会话终止成功消息,由所述物联网应用删除应用逻辑会话节点,终止会话。 a third sending module, configured to send a session termination success message carrying the logical session identifier to the Internet of Things platform, where the IoT platform deletes the platform logical session node and returns to the Internet of Things application The session termination success message identified by the logical session, the application logical session node is deleted by the Internet of Things application, and the session is terminated.
PCT/CN2016/085873 2015-10-19 2016-06-15 Method and device for realizing stateful operation in stateless network protocol WO2016197995A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201510681160.1A CN106603611A (en) 2015-10-19 2015-10-19 Method and device for achieving stateful operation in stateless network protocol
CN201510681160.1 2015-10-19

Publications (1)

Publication Number Publication Date
WO2016197995A1 true WO2016197995A1 (en) 2016-12-15

Family

ID=57504572

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/085873 WO2016197995A1 (en) 2015-10-19 2016-06-15 Method and device for realizing stateful operation in stateless network protocol

Country Status (2)

Country Link
CN (1) CN106603611A (en)
WO (1) WO2016197995A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111064784A (en) * 2019-12-12 2020-04-24 天翼物联科技有限公司 Internet of things session realization method, terminal, platform, system and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101072233A (en) * 2007-03-30 2007-11-14 腾讯科技(深圳)有限公司 Method and system for stimulating stateful connection based on stateless network protocol
CN102238201A (en) * 2010-04-23 2011-11-09 中兴通讯股份有限公司 Internet of things application module and communication method for Internet of things application and Internet of things terminal
WO2014124318A1 (en) * 2013-02-08 2014-08-14 Interdigital Patent Holdings, Inc. METHOD AND APPARATUS FOR INCORPORATING AN INTERNET OF THINGS (IoT) SERVICE INTERFACE PROTOCOL LAYER IN A NODE

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101072233A (en) * 2007-03-30 2007-11-14 腾讯科技(深圳)有限公司 Method and system for stimulating stateful connection based on stateless network protocol
CN102238201A (en) * 2010-04-23 2011-11-09 中兴通讯股份有限公司 Internet of things application module and communication method for Internet of things application and Internet of things terminal
WO2014124318A1 (en) * 2013-02-08 2014-08-14 Interdigital Patent Holdings, Inc. METHOD AND APPARATUS FOR INCORPORATING AN INTERNET OF THINGS (IoT) SERVICE INTERFACE PROTOCOL LAYER IN A NODE

Also Published As

Publication number Publication date
CN106603611A (en) 2017-04-26

Similar Documents

Publication Publication Date Title
CN109067914B (en) web service proxy method, device, equipment and storage medium
CN108667730B (en) Message forwarding method, device, storage medium and equipment based on load balancing
CN103780679B (en) Long delay remote invocation method based on http protocol
US9392081B2 (en) Method and device for sending requests
US9185077B2 (en) Isolation proxy server system
EP3211852A1 (en) Ssh protocol-based session parsing method and system
KR102208935B1 (en) Messaging api over http protocol to establish context for data exchange
US10958735B2 (en) Client connection method and system
US20160241664A1 (en) Method, device, and system for redirecting data by using service proxy
WO2014067311A1 (en) Resource subscription method and device
CN109327511B (en) Data request method and server based on HTTP (hyper text transport protocol)
US20140032730A1 (en) Delay-tolerant web transaction delegations
US11489810B2 (en) Intelligently routing a response packet along a same connection as a request packet
US20160337467A1 (en) Method and system for information exchange utilizing an asynchronous persistent store protocol
CN104506450A (en) Media resource feedback method and device
US20230421663A1 (en) Efficient resource representation exchange between service layers
CN111064729B (en) Message processing method and device, storage medium and electronic device
WO2016197995A1 (en) Method and device for realizing stateful operation in stateless network protocol
WO2020224241A1 (en) Cloud communication method and apparatus, user equipment, and network device
WO2019201111A1 (en) Information processing method, apparatus and device, and computer-readable storage medium
CN110661850A (en) Edge calculation method, system, computer equipment and storage medium
CN114172958B (en) Privacy computing node, system, method, device and storage medium
CN105912477B (en) A kind of method, apparatus and system that catalogue is read
CN110661895A (en) Network address mapping method and network address mapping equipment of server
CN113746794B (en) Account processing method and device, electronic equipment and computer storage medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 16806893

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 16806893

Country of ref document: EP

Kind code of ref document: A1