Web client webSocket and hardware Tcp connect to the same server, how to achieve web client smooth control of hardware devices?

to connect the hardware equipment of the Internet of things, the GatewayWorker, hardware I use to connect with the server through the tcp protocol to connect OK, through the port can successfully transmit data; the web client and the server can be connected to OK, through the websocket protocol through the protocol port to smoothly transmit data. After the web client connects through websocket and connects with the device through tcp, the data does not interchange. Now I do not know how the web page control command is transmitted to the device under the tcp connection through websocket, and how to obtain the device data under the tcp connection.

clipboard.png

Jul.07,2021

both tcp and ws call back the onmessage function of events class together. As long as you group tcp and ws during onconect, the WS side can send instructions to all tcp devices in groups, or you can list all tcp devices to the web page, and the WS side can send instructions separately according to the device id

.
Menu