Use nodejs to write a listener to get the data sent by the terminal to the server

I have an Internet of things terminal device that sends data to the designated port of the cloud server (including device number, base station information, light intensity temperature, etc.). Now I want to use nodejs to write a listener on the server side to listen for the data sent by the local port terminal. How can I listen to the data and serialize it?

Apr.11,2022

if you want to monitor the data sent by the terminal device, I think you should pay attention to two points:
1. How does the interrupt device send data to the port, whether it connects to the specified ip and port through socket, or connects to the designated port through http protocol. The scenarios for node's http and net modules are different.
2. The terminal can send the JSON string, and then parse it on the node side.
instance of http simple server

 

listening data

you can use package capture software, such as wireshark, tcpdump, etc., or call components such as libpcap.

serialize data

you need to know the communication protocol between the terminal and the server and how the data is exchanged.

Menu