CN112492034A - Information interaction method and device based on server - Google Patents

Information interaction method and device based on server Download PDF

Info

Publication number
CN112492034A
CN112492034A CN202011383502.9A CN202011383502A CN112492034A CN 112492034 A CN112492034 A CN 112492034A CN 202011383502 A CN202011383502 A CN 202011383502A CN 112492034 A CN112492034 A CN 112492034A
Authority
CN
China
Prior art keywords
target
information
main control
transmission channel
transmission
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202011383502.9A
Other languages
Chinese (zh)
Other versions
CN112492034B (en
Inventor
王雄泽
李铭
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
PCI Suntek Technology Co Ltd
Original Assignee
PCI Suntek Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by PCI Suntek Technology Co Ltd filed Critical PCI Suntek Technology Co Ltd
Priority to CN202011383502.9A priority Critical patent/CN112492034B/en
Publication of CN112492034A publication Critical patent/CN112492034A/en
Application granted granted Critical
Publication of CN112492034B publication Critical patent/CN112492034B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]
    • 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

Abstract

The embodiment of the application discloses a server-based information interaction method and device. The method comprises the following steps: receiving a request instruction for establishing a websocket protocol sent by a main control end, and establishing a first information transmission channel connected with the main control end; receiving a data transmission instruction and a target confirmation instruction sent by a main control end through a first information transmission channel, acquiring a transmission target according to the target confirmation instruction, sending a request instruction for establishing a websocket protocol to the transmission target, and establishing a second information transmission channel connected with the transmission target; receiving data format information sent by a transmission target through a second information transmission channel, and sending the data format information to a main control end through a first information transmission channel, so that the main control end processes the sensor data according to the data format information; the sensor data sent by the main control end is received through the first information transmission channel, and the sensor data is sent to a transmission target through the second information transmission channel, so that the transmission target displays the sensor data.

Description

Information interaction method and device based on server
Technical Field
The embodiment of the application relates to the technical field of information interaction, in particular to a server-based information interaction method and device.
Background
The enterprises engaged in production, storage, use, operation and transportation of chemicals relate to the industries of chemicals which have the characteristics of flammability, explosiveness, toxicity, harmfulness and corrosion and cause harm or damage to personnel, facilities and environment, and are called hazardous chemical industries. Because the product chain of the hazardous chemical industry is easily interfered by the outside world to send an accident, each link of the product chain needs to be monitored in real time.
For the dangerous chemical industry, the information of the abnormal conditions is very important, for example, the tank body is exploded, once accidents like this happen, a responsible person can pay very much attention to the accidents, and the accidents need to be known in real time. After an accident, each person in charge may use different equipment terminals in different places. In order to enable the responsible persons to know the detailed conditions of the accident, such as the real-time monitoring picture of tank body explosion, the on-site monitoring picture needs to be transmitted to the equipment end of each responsible person, so that the responsible persons can conveniently obtain the accident conditions in real time.
Disclosure of Invention
The embodiment of the application provides an information interaction method and device based on a server, which can transmit sensor data acquired by a sensor end to equipment ends of different responsible persons in real time, so that the responsible persons can conveniently acquire field conditions in real time.
In a first aspect, an embodiment of the present application provides a server-based information interaction method, including:
receiving a request instruction for establishing a websocket protocol sent by a main control end, upgrading the HTTP protocol into the websocket protocol, and establishing a first information transmission channel connected with the main control end; the first information transmission channel is a websocket protocol established between the main control end and the server;
receiving a data transmission instruction and a target confirmation instruction sent by the main control end through the first information transmission channel, acquiring a transmission target according to the target confirmation instruction, and sending a request instruction for establishing a websocket protocol to the transmission target, so as to establish a second information transmission channel connected with the transmission target; the second information transmission channel is a websocket protocol established between the server and the transmission target;
receiving data format information sent by the transmission target through the second information transmission channel, and sending the data format information to the main control end through the first information transmission channel, so that the main control end processes sensor data according to the data format information;
and receiving the processed sensor data sent by the main control end through the first information transmission channel, and sending the sensor data to the transmission target through the second information transmission channel, so that the transmission target displays the sensor data.
Further, before the step of receiving a request instruction for establishing a websocket protocol sent by a master control end, upgrading an HTTP protocol to the websocket protocol, and establishing a first information transmission channel connected to the master control end, the method further includes:
and monitoring a request instruction sent by the main control end through a socket interface.
Further, the step of receiving the data transmission instruction and the target confirmation instruction sent by the master control end through the first information transmission channel, obtaining a transmission target according to the target confirmation instruction, and sending a request instruction for establishing a websocket protocol to the transmission target, so as to establish a second information transmission channel connected with the transmission target includes:
receiving a data transmission instruction sent by the main control end through the first information transmission channel, and analyzing the data transmission instruction;
receiving a target confirmation instruction sent by the main control terminal through the first information transmission channel, analyzing the target confirmation instruction to obtain a transmission target selected by the main control terminal, and acquiring address information of the transmission target according to the transmission target and a preset communication directory;
and sending a request instruction for establishing a websocket protocol to the transmission target according to the address information, and establishing a second information transmission channel connected with the transmission target.
Further, the step of receiving, by the second information transmission channel, the data format information sent by the transmission target, and sending, by the first information transmission channel, the data format information to the master control end, so that the master control end processes the sensor data according to the data format information includes:
sending the sensor data obtained by analysis to the transmission target through the second information transmission channel, wherein the transmission target is used for judging whether the data format of the sensor data is consistent with a preset data format; the preset data format is a display data format configured by the transmission target for leaving a factory;
when the data format of the sensor data is inconsistent with a preset data format, receiving data format information sent by the transmission target through the second information transmission channel;
and sending the data format information to the main control end through the first information transmission channel, so that the main control end processes the sensor data according to the data format information.
Further, after the step of receiving the processed sensor data sent by the master control end through the first information transmission channel and sending the sensor data to the transmission target through the second information transmission channel so that the transmission target displays the sensor data, the method further includes:
receiving a request instruction for switching sensor data sent by the transmission target through the second information transmission channel, and analyzing the request for switching sensor data to obtain a target sensor selected by the transmission target and data format information of the transmission target;
the target sensor and the data format information are sent to the main control end through the first information transmission channel, and the main control end is used for acquiring corresponding sensor data according to the target sensor and processing the sensor data according to the data format information;
and acquiring the sensor data corresponding to the target sensor sent by the main control end through the first information transmission channel, and sending the sensor data to the transmission target through the second information transmission channel, so that the transmission target displays the sensor data.
In a second aspect, an embodiment of the present application provides an information interaction apparatus based on a server, including:
the first channel building module is configured to receive a request instruction for building a websocket protocol sent by a main control end, upgrade an HTTP (hyper text transport protocol) into the websocket protocol, and build a first information transmission channel connected with the main control end; the information transmission channel is a websocket protocol;
the second channel building module is configured to receive a data transmission instruction and a target confirmation instruction sent by the main control terminal through the first information transmission channel, obtain a transmission target according to the target confirmation instruction, and send a request instruction for building a websocket protocol to the transmission target, so that a second information transmission channel connected with the transmission target is built; the second information transmission channel is a websocket protocol established between the server and the transmission target;
the first interaction module is configured to receive data format information sent by the transmission target through the second information transmission channel, and send the data format information to the main control end through the first information transmission channel, so that the main control end processes sensor data according to the data format information;
the second interaction module is configured to receive the processed sensor data sent by the main control terminal through the first information transmission channel, and send the sensor data to the transmission target through the second information transmission channel, so that the transmission target displays the sensor data.
Further, the apparatus further comprises:
and the monitoring module is configured to monitor the request instruction sent by the main control terminal through a socket interface.
Further, the second channel building module comprises:
the first request processing unit is configured to receive a data transmission instruction sent by the main control terminal through the first information transmission channel and analyze the data transmission instruction;
the second request processing unit is configured to receive a target confirmation instruction sent by the main control terminal through the first information transmission channel, analyze the target confirmation instruction to obtain a transmission target selected by the main control terminal, and acquire address information of the transmission target according to the transmission target and a preset communication directory;
and the second channel building unit is configured to send a request instruction for building a websocket protocol to the transmission target according to the address information, and build a second information transmission channel connected with the transmission target.
Further, the first interaction module comprises:
the first transmission unit is configured to send the analyzed sensor data to the transmission target through the second information transmission channel, and the transmission target is used for judging whether the data format of the sensor data is consistent with a preset data format; the preset data format is a display data format configured by the transmission target for leaving a factory;
the receiving unit is configured to receive data format information sent by the transmission target through the second information transmission channel when the data format of the sensor data is inconsistent with a preset data format;
the second transmission unit is configured to send the data format information to the main control end through the first information transmission channel, so that the main control end processes the sensor data according to the data format information.
Further, the apparatus further comprises:
the third interaction module is configured to receive a request instruction for switching sensor data sent by the transmission target through the second information transmission channel, and analyze the request for switching sensor data to obtain a target sensor selected by the transmission target and data format information of the transmission target;
the fourth interaction module is configured to send the target sensor and the data format information to the main control end through the first information transmission channel, and is used for the main control end to acquire corresponding sensor data according to the target sensor and process the sensor data according to the data format information;
and the fifth interaction module is configured to acquire the sensor data corresponding to the target sensor, which is sent by the main control terminal, through the first information transmission channel, and send the sensor data to the transmission target through the second information transmission channel, so that the transmission target displays the sensor data.
In a third aspect, an embodiment of the present application provides an electronic device, including:
a memory and one or more processors;
the memory for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement the server-based information interaction method of the first aspect.
In a fourth aspect, embodiments of the present application provide a storage medium containing computer-executable instructions, which when executed by a computer processor, are configured to perform the server-based information interaction method according to the first aspect.
According to the method and the device, an HTTP (hyper text transport protocol) protocol is upgraded into a websocket protocol by receiving a request instruction for establishing the websocket protocol sent by a main control end, and a first information transmission channel connected with the main control end is established; receiving a data transmission instruction and a target confirmation instruction sent by the main control end through the first information transmission channel, acquiring a transmission target according to the target confirmation instruction, and sending a request instruction for establishing a websocket protocol to the transmission target, so as to establish a second information transmission channel connected with the transmission target; receiving data format information sent by the transmission target through the second information transmission channel, and sending the data format information to the main control end through the first information transmission channel, so that the main control end processes sensor data according to the data format information; and receiving the processed sensor data sent by the main control end through the first information transmission channel, and sending the sensor data to the transmission target through the second information transmission channel, so that the transmission target displays the sensor data. By adopting the technical means, the sensor data are transmitted to the transmission target in real time by respectively establishing the information transmission channels between the server and the main control terminal and between the server and the transmission target and based on the transfer function of the server. The server can also receive a request of the transmission target and request the main control end to send corresponding sensor data, so that the sensor data is sent to the transmission target, and information interaction between the transmission target and the main control end is realized.
Drawings
Fig. 1 is a flowchart of a server-based information interaction method according to an embodiment of the present application;
FIG. 2 is a schematic connection diagram of devices according to a first embodiment of the present disclosure;
fig. 3 is a flowchart of a second information transmission channel building process in the first embodiment of the present application;
FIG. 4 is a flowchart of information interaction in the first embodiment of the present application;
fig. 5 is a flowchart of a server-based information interaction method according to a second embodiment of the present application;
fig. 6 is a schematic structural diagram of a server-based information interaction device according to a third embodiment of the present application;
fig. 7 is a schematic structural diagram of an electronic device according to a fourth embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, specific embodiments of the present application will be described in detail with reference to the accompanying drawings. It is to be understood that the specific embodiments described herein are merely illustrative of the application and are not limiting of the application. It should be further noted that, for the convenience of description, only some but not all of the relevant portions of the present application are shown in the drawings. Before discussing exemplary embodiments in more detail, it should be noted that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although a flowchart may describe the operations (or steps) as a sequential process, many of the operations can be performed in parallel, concurrently or simultaneously. In addition, the order of the operations may be re-arranged. The process may be terminated when its operations are completed, but may have additional steps not included in the figure. The processes may correspond to methods, functions, procedures, subroutines, and the like.
The server-based information interaction method and device aim to achieve real-time transmission of sensor data to a transmission target based on the transfer function of the server by respectively establishing information transmission channels between the server and a main control terminal and between the server and the transmission target. The server can also receive a request of the transmission target and request the main control end to send corresponding sensor data, so that the sensor data is sent to the transmission target, and information interaction between the transmission target and the main control end is realized. Compared with the traditional data transmission, the data transmission is slow, the real-time transmission of the data is difficult to realize, in the data transmission process, the connection target can be identified only by establishing a connection relation every time during data transmission, so that the overall data transmission efficiency is reduced, the traditional data transmission mode can only carry out one-way transmission, only the data is transmitted to the transmission target from the main control end, the data returned by the transmission target cannot be obtained, and therefore information interaction cannot be carried out. Based on this, the information interaction method based on the server in the embodiment of the application. The problem that real-time data transmission and information interaction cannot be achieved by the existing data transmission technology is solved.
The first embodiment is as follows:
fig. 1 is a flowchart of a server-based information interaction method according to an embodiment of the present disclosure, where the server-based information interaction method provided in this embodiment may be executed by a server device, and the server device may be implemented in a software and/or hardware manner, and may be a physical entity server or a cloud server. The following description will be given taking a server device as an example of a main body for executing the information interaction method. Referring to fig. 1, the information interaction method specifically includes:
s110, receiving a request instruction for establishing a websocket protocol sent by a main control end, upgrading the HTTP into the websocket protocol, and establishing a first information transmission channel connected with the main control end; the first information transmission channel is a websocket protocol established between the main control end and the server.
Specifically, referring to fig. 2, when the information interaction method according to the embodiment of the present application performs sensor data transmission, a server receives a request instruction for establishing a websocket protocol sent by a main control end, and the server responds to the request instruction and upgrades an HTTP protocol, in which the server is connected to the main control end, to the websocket protocol, so that a first information transmission channel between the main control end and the server is established, that is, the websocket protocol is established between the main control end and the server. The Websocket protocol is a protocol for carrying out full-duplex communication on a single TCP connection, and in the Websocket protocol, a main control end and a server only need to complete one connection establishment request, and persistent connection can be directly established between the main control end and the server for bidirectional data transmission. The acquisition end is connected with the main control end, the acquired sensor data are transmitted to the main control end in real time, the main control end selects a transmission target which is correspondingly transmitted, and the transmission target is generally an equipment end and comprises a PC end, a large screen end, a mobile end and the like.
Specifically, in an embodiment, before the step of receiving a request instruction for establishing a websocket protocol sent by a master control end, upgrading an HTTP protocol to the websocket protocol, and connecting the master control end through an information transmission channel, the method further includes: and monitoring a request instruction sent by the main control end through a socket interface.
For example, before the master controller has not established the websocket protocol with the server, the server socket needs to monitor the connection request of the master controller in real time. The working process of the connection between the main control end and the server is specifically server monitoring; a request of a main control terminal; and (5) connection confirmation. The server monitoring means that the server socket does not locate a specific master control end socket, but is in a state of waiting for connection, and monitors the network state in real time. The master control request refers to a request for connection made by a socket of the master control, and the target to be connected is the socket of the server. For this purpose, the socket of the master must first describe the socket of the server to which it is to connect, indicate the address and port number of the server socket, and then make a connection request to the server socket.
S120, receiving a data transmission instruction and a target confirmation instruction sent by the main control end through the first information transmission channel, obtaining a transmission target according to the target confirmation instruction, and sending a request instruction for establishing a websocket protocol to the transmission target so as to establish a second information transmission channel connected with the transmission target; the second information transmission channel is a websocket protocol established between the server and the transmission target.
Illustratively, the master control end sends a data transmission instruction and a target confirmation instruction to the server through the first information transmission channel, and aims to inform the server, the master control end wants to send sensor data to the target equipment end, and asks the server to build an information transmission channel connected with the target equipment end, and the target equipment end is a transmission target. The data transmission instruction may include sensor data, the master control end directly sends the sensor data to the server, the server sends the sensor data to the target equipment end, or the data transmission instruction may not include the sensor data, and after the server is connected with the target equipment end, the server sends the corresponding sensor data according to the requirements of the target equipment end. The target confirmation instruction comprises address information of the target equipment end, and the server searches and connects the target equipment end according to the address information.
Specifically, referring to fig. 2, the server sends a request instruction for establishing a websocket protocol to the target device, establishes a second information transmission channel based on the websocket protocol, and receives information sent by the target device and sends information to the target device through the second information transmission channel. The general target device end can be a plurality of device ends, and a one-to-one information transmission channel can be established between the server and different target device ends.
Specifically, referring to fig. 3, the second information transmission channel building process includes:
s1201, receiving a data transmission instruction sent by the main control terminal through the first information transmission channel, and analyzing the data transmission instruction;
s1202, receiving a target confirmation instruction sent by the main control end through the first information transmission channel, analyzing the target confirmation instruction to obtain a transmission target selected by the main control end, and acquiring address information of the transmission target according to the transmission target and a preset communication directory;
s1203, according to the address information, sending a request instruction for establishing a websocket protocol to the transmission target, and establishing a second information transmission channel connected with the transmission target.
Illustratively, the server receives and analyzes a data transmission instruction sent by the main control end through the first information transmission channel, so as to know that the main control end needs to send the sensor data to a certain equipment end. Then, the server receives a target confirmation instruction sent by the main control end through the first information transmission channel, and acquires address information (namely, address information of a transmission target) of the target equipment end from the target confirmation instruction, so that which target equipment end the main control end wants to transmit is known. Therefore, the server finds the target equipment side based on the address information, sends a request instruction for establishing the websocket protocol to the target equipment side, and establishes a second information transmission channel based on the websocket protocol between the target equipment side and the server after the target equipment side receives the request for establishing the websocket protocol. And after the server establishes a second information transmission channel connected with the target equipment terminal, if the data transmission instruction is analyzed to obtain sensor data, the sensor data sent by the main control terminal is sent to the target equipment terminal for the target equipment terminal to display the sensor data. In the websocket protocol, the target equipment end and the server only need to complete one connection establishment request, and persistent connection can be directly established between the target equipment end and the server, and bidirectional data transmission is performed, so that no matter the main control end sends a data transmission instruction and a target confirmation instruction to the server end, or the server sends sensor data to the target equipment end, the connection request does not need to be sent to the target equipment end, but information is directly sent through the second information transmission channel and the first information transmission channel, and the data transmission efficiency is improved.
S130, receiving data format information sent by the transmission target through the second information transmission channel, and sending the data format information to the main control end through the first information transmission channel, so that the main control end processes sensor data according to the data format information.
Illustratively, the data transmission instruction sent by the main control end to the server does not include sensor data, the target device end (i.e., the transmission target) sends its own data format information to the server through the second information transmission channel, and after receiving the data format information, the server learns that the target device end is in a mode capable of displaying the sensor data, so that the data format information is sent to the main control end through the first information transmission channel, the main control end is informed that the target device end receives the sensor data constantly, but the sensor data needs to be processed according to the data format information, and the sensor data conforming to the data format of the target device end can be normally displayed by the target device end.
For example, the data transmission instruction sent by the master control end to the server includes sensor data, and with reference to fig. 4, specifically, the information interaction flow includes:
s1301, sending the sensor data obtained through analysis to the transmission target through the second information transmission channel, wherein the transmission target is used for judging whether the data format of the sensor data is consistent with a preset data format; the preset data format is a display data format configured by the transmission target for leaving a factory;
s1302, receiving data format information sent by the transmission target through the second information transmission channel when the data format of the sensor data is inconsistent with a preset data format;
s1303, the data format information is sent to the main control end through the first information transmission channel, so that the main control end processes the sensor data according to the data format information.
For example, when the server sends the sensor data to the target device end through the second information transmission channel, the sensor data cannot be normally displayed because the data format of the sensor data is not matched with the data format that can be displayed at the target device end, and the main control end is required to adjust the sensor data according to the data format information of the target device end. Then, the target device sends its own data format information to the server through the second information transmission channel, the server forwards the data format information, and sends the data format information to the main control end through the first information transmission channel. After receiving the data format information, the main control end learns that the sensor data sent in advance is not in accordance with the data format of the target equipment end, so that the sensor data is found out from the database, and the data format of the sensor data is adjusted according to the data format information. Based on the transfer function of the server, the information interaction between the main control end and the target equipment end is realized.
S140, receiving the processed sensor data sent by the main control end through the first information transmission channel, and sending the sensor data to the transmission target through the second information transmission channel, so that the transmission target displays the sensor data.
For example, the server serves as an information transfer station of the main control end and the device end, and after receiving the sensor data sent by the main control end, the server sends the sensor data to the target device end. Based on the transfer function of the server, the sensor data meeting the requirements of the target equipment terminal in real time is sent to the target equipment terminal.
In summary, by receiving a request instruction for establishing a websocket protocol sent by a main control end, upgrading an HTTP protocol into the websocket protocol, and establishing a first information transmission channel connected to the main control end; receiving a data transmission instruction and a target confirmation instruction sent by the main control end through the first information transmission channel, acquiring a transmission target according to the target confirmation instruction, and sending a request instruction for establishing a websocket protocol to the transmission target, so as to establish a second information transmission channel connected with the transmission target; receiving data format information sent by the transmission target through the second information transmission channel, and sending the data format information to the main control end through the first information transmission channel, so that the main control end processes sensor data according to the data format information; and receiving the processed sensor data sent by the main control end through the first information transmission channel, and sending the sensor data to the transmission target through the second information transmission channel, so that the transmission target displays the sensor data. By adopting the technical means, the sensor data are transmitted to the transmission target in real time by respectively establishing the information transmission channels between the server and the main control terminal and between the server and the transmission target and based on the transfer function of the server. The server can also receive a request of the transmission target and request the main control end to send corresponding sensor data, so that the sensor data is sent to the transmission target, and information interaction between the transmission target and the main control end is realized.
Example two:
on the basis of the first embodiment, fig. 5 is a flowchart of a server-based information interaction method provided in the second embodiment of the present application. Referring to fig. 5, a server-based information interaction method includes:
s210, receiving a request instruction for establishing a websocket protocol sent by a main control end, upgrading the HTTP into the websocket protocol, and establishing a first information transmission channel connected with the main control end; the first information transmission channel is a websocket protocol established between the main control end and the server.
S220, receiving a data transmission instruction and a target confirmation instruction sent by the main control end through the first information transmission channel, obtaining a transmission target according to the target confirmation instruction, and sending a request instruction for establishing a websocket protocol to the transmission target so as to establish a second information transmission channel connected with the transmission target; the second information transmission channel is a websocket protocol established between the server and the transmission target.
And S230, receiving the data format information sent by the transmission target through the second information transmission channel, and sending the data format information to the main control end through the first information transmission channel, so that the main control end processes the sensor data according to the data format information.
S240, receiving the processed sensor data sent by the main control end through the first information transmission channel, and sending the sensor data to the transmission target through the second information transmission channel, so that the transmission target displays the sensor data.
And S250, receiving a request instruction for switching sensor data sent by the transmission target through the second information transmission channel, and analyzing the request for switching the sensor data to obtain the target sensor selected by the transmission target and the data format information of the transmission target.
And S260, sending the target sensor and the data format information to the main control end through the first information transmission channel, wherein the main control end is used for acquiring corresponding sensor data according to the target sensor and processing the sensor data according to the data format information.
S270, acquiring sensor data corresponding to the target sensor sent by the main control end through the first information transmission channel, and sending the sensor data to the transmission target through the second information transmission channel, so that the transmission target displays the sensor data.
For example, after the target device side (i.e., the transmission target) displays the sensor data sent by the main control side, the device side user wants to switch the sensor data, for example, the target device side is playing a monitoring picture of the monitoring device above the tank body explosion field, and the responsible person at the device side wants to obtain a monitoring picture of the monitoring device on the side of the tank body explosion field. And sending a request instruction for switching the sensor data to the server through the target equipment end, wherein the request instruction comprises the target sensor and the data format information requested by the target equipment end. The server receives the request instruction, learns that the target equipment end wants to acquire new sensor data, then sends target sensor and data format information to the main control end through the first information transmission channel, informs the main control end that the target equipment end requests to display the sensor data of the target sensor, and reminds the main control end to remember to process the sensor data according to the data format information. And then the main control end acquires corresponding sensor data from the database according to the target sensor, performs corresponding data format adjustment on the sensor data, sends the sensor data to the server through the first information transmission channel, informs the server that the sensor data requested by the target equipment end is sent, and requests the server to receive and forward the sensor data to the target equipment end. And then the server receives sensor data corresponding to the target sensor and sends the sensor data to the target equipment end through the second information transmission channel, and the target equipment end displays the sensor data on the display screen after receiving the sensor data. The main control end receives the request instruction sent by the equipment end through the server, corresponding data are sent according to the request instruction of the equipment end, the target equipment end does not passively receive information sent by the main control end any more, the target equipment end can put forward self requirements to the main control end, and user experience of the equipment end is improved.
In summary, in the embodiment, the sensor data is sent to the transmission target in real time by establishing the information transmission channels between the server and the main control terminal and between the server and the transmission target respectively and based on the transfer function of the server. The server can also receive a request of the transmission target and request the main control end to send corresponding sensor data, so that the sensor data is sent to the transmission target, and information interaction between the transmission target and the main control end is realized.
Example three:
on the basis of the foregoing embodiments, fig. 6 is a schematic structural diagram of an information interaction device based on a server according to a third embodiment of the present application. Referring to fig. 6, the information interaction apparatus based on a server provided in this embodiment specifically includes: a first channel building module 21, a second channel building module 22, a first interaction module 23 and a second interaction module 24, wherein:
the first channel building module 21 is configured to receive a request instruction for building a websocket protocol sent by a main control end, upgrade an HTTP protocol into the websocket protocol, and build a first information transmission channel connected to the main control end; the information transmission channel is a websocket protocol;
the second channel building module 22 is configured to receive the data transmission instruction and the target confirmation instruction sent by the master control end through the first information transmission channel, obtain a transmission target according to the target confirmation instruction, and send a request instruction for building a websocket protocol to the transmission target, so as to build a second information transmission channel connected with the transmission target; the second information transmission channel is a websocket protocol established between the server and the transmission target;
the first interaction module 23 is configured to receive data format information sent by the transmission target through the second information transmission channel, and send the data format information to the main control end through the first information transmission channel, so that the main control end processes sensor data according to the data format information;
the second interaction module 24 is configured to receive the processed sensor data sent by the master control end through the first information transmission channel, and send the sensor data to the transmission target through the second information transmission channel, so that the transmission target displays the sensor data.
Specifically, in an embodiment, the server-based information interaction apparatus further includes:
and the monitoring module is configured to monitor the request instruction sent by the main control terminal through a socket interface.
Specifically, in one embodiment, the second channel building module includes:
the first request processing unit is configured to receive a data transmission instruction sent by the main control terminal through the first information transmission channel and analyze the data transmission instruction;
the second request processing unit is configured to receive a target confirmation instruction sent by the main control terminal through the first information transmission channel, analyze the target confirmation instruction to obtain a transmission target selected by the main control terminal, and acquire address information of the transmission target according to the transmission target and a preset communication directory;
and the second channel building unit is configured to send a request instruction for building a websocket protocol to the transmission target according to the address information, and build a second information transmission channel connected with the transmission target. Specifically, in one embodiment, the first interaction module includes:
the first transmission unit is configured to send the analyzed sensor data to the transmission target through the second information transmission channel, and the transmission target is used for judging whether the data format of the sensor data is consistent with a preset data format; the preset data format is a display data format configured by the transmission target for leaving a factory;
the receiving unit is configured to receive data format information sent by the transmission target through the second information transmission channel when the data format of the sensor data is inconsistent with a preset data format;
the second transmission unit is configured to send the data format information to the main control end through the first information transmission channel, so that the main control end processes the sensor data according to the data format information.
Specifically, in an embodiment, the server-based information interaction apparatus further includes:
the third interaction module is configured to receive a request instruction for switching sensor data sent by the transmission target through the second information transmission channel, and analyze the request for switching sensor data to obtain a target sensor selected by the transmission target and data format information of the transmission target;
the fourth interaction module is configured to send the target sensor and the data format information to the main control end through the first information transmission channel, and is used for the main control end to acquire corresponding sensor data according to the target sensor and process the sensor data according to the data format information;
and the fifth interaction module is configured to acquire the sensor data corresponding to the target sensor, which is sent by the main control terminal, through the first information transmission channel, and send the sensor data to the transmission target through the second information transmission channel, so that the transmission target displays the sensor data.
In summary, by receiving a request instruction for establishing a websocket protocol sent by a main control end, upgrading an HTTP protocol into the websocket protocol, and establishing a first information transmission channel connected to the main control end; receiving a data transmission instruction and a target confirmation instruction sent by the main control end through the first information transmission channel, acquiring a transmission target according to the target confirmation instruction, and sending a request instruction for establishing a websocket protocol to the transmission target, so as to establish a second information transmission channel connected with the transmission target; receiving data format information sent by the transmission target through the second information transmission channel, and sending the data format information to the main control end through the first information transmission channel, so that the main control end processes sensor data according to the data format information; and receiving the processed sensor data sent by the main control end through the first information transmission channel, and sending the sensor data to the transmission target through the second information transmission channel, so that the transmission target displays the sensor data. By adopting the technical means, the sensor data are transmitted to the transmission target in real time by respectively establishing the information transmission channels between the server and the main control terminal and between the server and the transmission target and based on the transfer function of the server. The server can also receive a request of the transmission target and request the main control end to send corresponding sensor data, so that the sensor data is sent to the transmission target, and information interaction between the transmission target and the main control end is realized.
The server-based information interaction device provided by the third embodiment of the application can be used for executing the server-based information interaction method provided by the first embodiment of the application, and has corresponding functions and beneficial effects.
Example four:
an embodiment of the present application provides an electronic device, and with reference to fig. 7, the electronic device includes: a processor 31, a memory 32, a communication module 33, an input device 34, and an output device 35. The number of processors in the electronic device may be one or more, and the number of memories in the electronic device may be one or more. The processor, memory, communication module, input device, and output device of the electronic device may be connected by a bus or other means.
The memory 32 is used as a computer-readable storage medium and can be used for storing software programs, computer-executable programs, and modules, such as program instructions/modules corresponding to the server-based information interaction method according to any embodiment of the present application (for example, the first channel building module, the second channel building module, the first interaction module, and the second interaction module in the server-based information interaction device). The memory can mainly comprise a program storage area and a data storage area, wherein the program storage area can store an operating system and an application program required by at least one function; the storage data area may store data created according to use of the device, and the like. Further, the memory may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some examples, the memory may further include memory located remotely from the processor, and these remote memories may be connected to the device over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The communication module 33 is used for data transmission.
The processor 31 executes various functional applications of the device and data processing by executing software programs, instructions and modules stored in the memory, that is, implements the above-described server-based information interaction method.
The input device 34 may be used to receive entered numeric or character information and to generate key signal inputs relating to user settings and function controls of the apparatus. The output device 35 may include a display device such as a display screen.
The electronic device provided by the above can be used to execute the server-based information interaction method provided by the first embodiment, and has corresponding functions and advantages.
Example five:
embodiments of the present application also provide a storage medium containing computer-executable instructions, which when executed by a computer processor, are configured to perform a server-based information interaction method, including: receiving a request instruction for establishing a websocket protocol sent by a main control end, upgrading the HTTP protocol into the websocket protocol, and establishing a first information transmission channel connected with the main control end; the first information transmission channel is a websocket protocol established between the main control end and the server; receiving a data transmission instruction and a target confirmation instruction sent by the main control end through the first information transmission channel, acquiring a transmission target according to the target confirmation instruction, and sending a request instruction for establishing a websocket protocol to the transmission target, so as to establish a second information transmission channel connected with the transmission target; the second information transmission channel is a websocket protocol established between the server and the transmission target; receiving data format information sent by the transmission target through the second information transmission channel, and sending the data format information to the main control end through the first information transmission channel, so that the main control end processes sensor data according to the data format information; and receiving the processed sensor data sent by the main control end through the first information transmission channel, and sending the sensor data to the transmission target through the second information transmission channel, so that the transmission target displays the sensor data.
Storage medium-any of various types of memory devices or storage devices. The term "storage medium" is intended to include: mounting media such as CD-ROM, floppy disk, or tape devices; computer system memory or random access memory such as DRAM, DDR RAM, SRAM, EDO RAM, Lanbas (Rambus) RAM, etc.; non-volatile memory such as flash memory, magnetic media (e.g., hard disk or optical storage); registers or other similar types of memory elements, etc. The storage medium may also include other types of memory or combinations thereof. In addition, the storage medium may be located in a first computer system in which the program is executed, or may be located in a different second computer system connected to the first computer system through a network (such as the internet). The second computer system may provide program instructions to the first computer for execution. The term "storage medium" may include two or more storage media residing in different locations, e.g., in different computer systems connected by a network. The storage medium may store program instructions (e.g., embodied as a computer program) that are executable by one or more processors.
Of course, the storage medium provided in the embodiments of the present application contains computer-executable instructions, and the computer-executable instructions are not limited to the server-based information interaction method described above, and may also perform related operations in the server-based information interaction method provided in any embodiment of the present application.
The server-based information interaction device, the storage medium, and the electronic device provided in the foregoing embodiments may execute the server-based information interaction method provided in any embodiment of the present application, and reference may be made to the server-based information interaction method provided in any embodiment of the present application without detailed technical details described in the foregoing embodiments.
The foregoing is considered as illustrative of the preferred embodiments of the invention and the technical principles employed. The present application is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present application has been described in more detail with reference to the above embodiments, the present application is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present application, and the scope of the present application is determined by the scope of the claims.

Claims (12)

1. A server-based information interaction method is characterized by comprising the following steps:
receiving a request instruction for establishing a websocket protocol sent by a main control end, upgrading the HTTP protocol into the websocket protocol, and establishing a first information transmission channel connected with the main control end; the first information transmission channel is a websocket protocol established between the main control end and the server;
receiving a data transmission instruction and a target confirmation instruction sent by the main control end through the first information transmission channel, acquiring a transmission target according to the target confirmation instruction, and sending a request instruction for establishing a websocket protocol to the transmission target, so as to establish a second information transmission channel connected with the transmission target; the second information transmission channel is a websocket protocol established between the server and the transmission target;
receiving data format information sent by the transmission target through the second information transmission channel, and sending the data format information to the main control end through the first information transmission channel, so that the main control end processes sensor data according to the data format information;
and receiving the processed sensor data sent by the main control end through the first information transmission channel, and sending the sensor data to the transmission target through the second information transmission channel, so that the transmission target displays the sensor data.
2. The method according to claim 1, wherein before the step of receiving a request instruction for establishing a websocket protocol sent by a master control end, upgrading an HTTP protocol to the websocket protocol, and establishing a first information transmission channel connected to the master control end, the method further comprises:
and monitoring a request instruction sent by the main control end through a socket interface.
3. The method according to claim 1, wherein the step of receiving a data transmission command and a target confirmation command sent by the master control end through the first information transmission channel, obtaining a transmission target according to the target confirmation command, sending a request command for establishing a websocket protocol to the transmission target, and thereby establishing a second information transmission channel connecting the transmission target comprises:
receiving a data transmission instruction sent by the main control end through the first information transmission channel, and analyzing the data transmission instruction;
receiving a target confirmation instruction sent by the main control terminal through the first information transmission channel, analyzing the target confirmation instruction to obtain a transmission target selected by the main control terminal, and acquiring address information of the transmission target according to the transmission target and a preset communication directory;
and sending a request instruction for establishing a websocket protocol to the transmission target according to the address information, and establishing a second information transmission channel connected with the transmission target.
4. The method according to claim 3, wherein the step of receiving the data format information sent by the transmission target through the second information transmission channel and sending the data format information to the master control end through the first information transmission channel, so that the master control end processes the sensor data according to the data format information includes:
sending the sensor data obtained by analysis to the transmission target through the second information transmission channel, wherein the transmission target is used for judging whether the data format of the sensor data is consistent with a preset data format; the preset data format is a display data format configured by the transmission target for leaving a factory;
when the data format of the sensor data is inconsistent with a preset data format, receiving data format information sent by the transmission target through the second information transmission channel;
and sending the data format information to the main control end through the first information transmission channel, so that the main control end processes the sensor data according to the data format information.
5. The method according to claim 1, wherein after the step of receiving the processed sensor data sent by the master control end through the first information transmission channel and sending the sensor data to the transmission target through the second information transmission channel, so that the transmission target displays the sensor data, the method further comprises:
receiving a request instruction for switching sensor data sent by the transmission target through the second information transmission channel, and analyzing the request for switching sensor data to obtain a target sensor selected by the transmission target and data format information of the transmission target;
the target sensor and the data format information are sent to the main control end through the first information transmission channel, and the main control end is used for acquiring corresponding sensor data according to the target sensor and processing the sensor data according to the data format information;
and acquiring the sensor data corresponding to the target sensor sent by the main control end through the first information transmission channel, and sending the sensor data to the transmission target through the second information transmission channel, so that the transmission target displays the sensor data.
6. An information interaction device based on a server, comprising:
the first channel building module is configured to receive a request instruction for building a websocket protocol sent by a main control end, upgrade an HTTP (hyper text transport protocol) into the websocket protocol, and build a first information transmission channel connected with the main control end; the information transmission channel is a websocket protocol;
the second channel building module is configured to receive a data transmission instruction and a target confirmation instruction sent by the main control terminal through the first information transmission channel, obtain a transmission target according to the target confirmation instruction, and send a request instruction for building a websocket protocol to the transmission target, so that a second information transmission channel connected with the transmission target is built; the second information transmission channel is a websocket protocol established between the server and the transmission target;
the first interaction module is configured to receive data format information sent by the transmission target through the second information transmission channel, and send the data format information to the main control end through the first information transmission channel, so that the main control end processes sensor data according to the data format information;
the second interaction module is configured to receive the processed sensor data sent by the main control terminal through the first information transmission channel, and send the sensor data to the transmission target through the second information transmission channel, so that the transmission target displays the sensor data.
7. The apparatus of claim 6, further comprising:
and the monitoring module is configured to monitor the request instruction sent by the main control terminal through a socket interface.
8. The apparatus of claim 6, wherein the second channel building module comprises:
the first request processing unit is configured to receive a data transmission instruction sent by the main control terminal through the first information transmission channel and analyze the data transmission instruction;
the second request processing unit is configured to receive a target confirmation instruction sent by the main control terminal through the first information transmission channel, analyze the target confirmation instruction to obtain a transmission target selected by the main control terminal, and acquire address information of the transmission target according to the transmission target and a preset communication directory;
and the second channel building unit is configured to send a request instruction for building a websocket protocol to the transmission target according to the address information, and build a second information transmission channel connected with the transmission target.
9. The apparatus of claim 8, wherein the first interaction module comprises:
the first transmission unit is configured to send the analyzed sensor data to the transmission target through the second information transmission channel, and the transmission target is used for judging whether the data format of the sensor data is consistent with a preset data format; the preset data format is a display data format configured by the transmission target for leaving a factory;
the receiving unit is configured to receive data format information sent by the transmission target through the second information transmission channel when the data format of the sensor data is inconsistent with a preset data format;
the second transmission unit is configured to send the data format information to the main control end through the first information transmission channel, so that the main control end processes the sensor data according to the data format information.
10. The apparatus of claim 6, further comprising:
the third interaction module is configured to receive a request instruction for switching sensor data sent by the transmission target through the second information transmission channel, and analyze the request for switching sensor data to obtain a target sensor selected by the transmission target and data format information of the transmission target;
the fourth interaction module is configured to send the target sensor and the data format information to the main control end through the first information transmission channel, and is used for the main control end to acquire corresponding sensor data according to the target sensor and process the sensor data according to the data format information;
and the fifth interaction module is configured to acquire the sensor data corresponding to the target sensor, which is sent by the main control terminal, through the first information transmission channel, and send the sensor data to the transmission target through the second information transmission channel, so that the transmission target displays the sensor data.
11. An electronic device, comprising:
a memory and one or more processors;
the memory for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement the information interaction method of any one of claims 1-5.
12. A storage medium containing computer-executable instructions for performing the method of information interaction of any of claims 1-5 when executed by a computer processor.
CN202011383502.9A 2020-12-01 2020-12-01 Information interaction method and device based on server Active CN112492034B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011383502.9A CN112492034B (en) 2020-12-01 2020-12-01 Information interaction method and device based on server

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011383502.9A CN112492034B (en) 2020-12-01 2020-12-01 Information interaction method and device based on server

Publications (2)

Publication Number Publication Date
CN112492034A true CN112492034A (en) 2021-03-12
CN112492034B CN112492034B (en) 2022-08-02

Family

ID=74938366

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011383502.9A Active CN112492034B (en) 2020-12-01 2020-12-01 Information interaction method and device based on server

Country Status (1)

Country Link
CN (1) CN112492034B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113727056A (en) * 2021-08-30 2021-11-30 聚好看科技股份有限公司 Data transmission connection management method and server

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160212213A1 (en) * 2013-08-29 2016-07-21 Seiko Epson Corporation Transmission System, Transmission Device, and Data Transmission Method
CN107172051A (en) * 2017-05-23 2017-09-15 南京邮电大学 A kind of method that internet of things equipment finds and managed
CN107566314A (en) * 2016-06-30 2018-01-09 阿里巴巴集团控股有限公司 A kind of data transmission system, method and apparatus
CN108737768A (en) * 2017-04-13 2018-11-02 北京视联动力国际信息技术有限公司 A kind of monitoring method and monitoring device based on monitoring system
CN108881361A (en) * 2017-12-26 2018-11-23 北京视联动力国际信息技术有限公司 A kind of data push method and device based on view networking
CN109688369A (en) * 2019-01-15 2019-04-26 随锐科技股份有限公司 Video conference control method
CN110113396A (en) * 2019-04-22 2019-08-09 珠海天燕科技有限公司 A kind of method and apparatus of controlling terminal

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160212213A1 (en) * 2013-08-29 2016-07-21 Seiko Epson Corporation Transmission System, Transmission Device, and Data Transmission Method
CN107566314A (en) * 2016-06-30 2018-01-09 阿里巴巴集团控股有限公司 A kind of data transmission system, method and apparatus
CN108737768A (en) * 2017-04-13 2018-11-02 北京视联动力国际信息技术有限公司 A kind of monitoring method and monitoring device based on monitoring system
CN107172051A (en) * 2017-05-23 2017-09-15 南京邮电大学 A kind of method that internet of things equipment finds and managed
CN108881361A (en) * 2017-12-26 2018-11-23 北京视联动力国际信息技术有限公司 A kind of data push method and device based on view networking
CN109688369A (en) * 2019-01-15 2019-04-26 随锐科技股份有限公司 Video conference control method
CN110113396A (en) * 2019-04-22 2019-08-09 珠海天燕科技有限公司 A kind of method and apparatus of controlling terminal

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
焦东来等: "面向空间信息的数据通信协议的设计与实现", 《计算机工程与设计》 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113727056A (en) * 2021-08-30 2021-11-30 聚好看科技股份有限公司 Data transmission connection management method and server
CN113727056B (en) * 2021-08-30 2023-09-22 聚好看科技股份有限公司 Management method and server for data transmission connection

Also Published As

Publication number Publication date
CN112492034B (en) 2022-08-02

Similar Documents

Publication Publication Date Title
CN103495979B (en) Explosive-handling robot controlled through wireless and wired channels
CN111866160B (en) Multi-machine control method, device, equipment and storage medium
CN112492034B (en) Information interaction method and device based on server
JPWO2014188530A1 (en) Monitoring system, facility management apparatus, monitoring method and program
US20150127821A1 (en) Control device
CN109683780A (en) Control method, system and the controlled terminal of mobile terminal
CN111935177B (en) Service control method and device
CN109696867A (en) Method, user terminal and the GNSS device management system of user terminal processes GNSS device data
CN110830579B (en) Equipment state display method, system, device and computer storage medium
US20180192448A1 (en) Method, device, and system for audio bluetooth pairing and connecting
CN109634856B (en) IOS intelligent terminal remote real machine debugging system and method based on cloud service
CN111831513A (en) Log query method and device, electronic equipment and storage medium
CN105578122A (en) Monitoring prompt method based on router, apparatus and electronic equipment thereof
CN107766066B (en) Method for updating slave module firmware
CN112187943B (en) Data synchronization method and device and system using same
CN112188090B (en) Camera system multithread control method, device, server and storage medium
CN112486446B (en) Content editing method and device based on server
CN112671814B (en) Cross-platform equipment development method, device and system
CN112698641B (en) ECU data transmission method and device, vehicle-mounted control terminal and storage medium
CN114281563A (en) Application program reconstruction method and device
US20160036658A1 (en) Method for testing a mobility device
CN114691486A (en) Program debugging method and device and computer equipment
CN112800604A (en) Simulation method, device, equipment and storage medium applied to industrial detection
CN107102874B (en) Application concurrent installation method and system
CN112486396B (en) Content editing method and device for multiple large screen ends

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information

Address after: Room 306, zone 2, building 1, Fanshan entrepreneurship center, Panyu energy saving technology park, No. 832 Yingbin Road, Donghuan street, Panyu District, Guangzhou City, Guangdong Province

Applicant after: Jiadu Technology Group Co.,Ltd.

Address before: Room 306, zone 2, building 1, Fanshan entrepreneurship center, Panyu energy saving technology park, No. 832 Yingbin Road, Donghuan street, Panyu District, Guangzhou City, Guangdong Province

Applicant before: PCI-SUNTEKTECH Co.,Ltd.

CB02 Change of applicant information
GR01 Patent grant
GR01 Patent grant