How to send data back to client with CUSTOM TCP SERVER

TuomoHautala 7 years ago in Applications / i3 Pro updated by Aleksandr Romanov (CTO) 7 years 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")


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]);