0
Answered

How to send data back to client with CUSTOM TCP SERVER

TuomoHautala 6 months ago in Applications / i3 Pro • updated by Aleksandr Romanov (CTO) 6 months ago 2

I have created CUSTOM_SERVER_TCP and we can connect with our clients to it.

Clients are sending data to server. (Example "GET ROOM TEPERATURE")

We can receive data with EVENT_RECEIVE_TEXT.

How can we send data back to client? (Example "ROOM TEPERATURE 24 °C")

+1

When you have something like this:

var MyTCPServer = IR.CreateDevice(IR.DEVICE_CUSTOM_SERVER_TCP, "MyTCPServer",  {Port: 3000,  MaxClients: 3});


just use the Send Method like

MyTCPServer.Send(['ROOM TEMPERATURE 24 °C',10,13]);