0
Answered
How to listen clients with iRidium server.
TuomoHautala 8 years ago
in Applications / i3 Pro
•
updated by Aleksandr Romanov (CTO) 7 years ago •
5
Another odd question. I have set up iRidium server and it is easy create drivers (clients) that will connect to equipment. But now i have client that will connect to iRidium server and send commands / requests to server. I have no idea how can I listen and log those request / commands from script. So how is that done? :)
Customer support service by UserEcho
Log: http://support.iridiummobile.net/topics/12357-log-of-channels-and-feedbacks-in-ui/
Connected users: http://dev.iridiummobile.net/Server_API/en#IR.EVENT_AUTHORIZE
Catch tag change: http://dev.iridiummobile.net/Editor_Server_Tools/en#Activation_of_scenes_from_control_panels
[code]
IR.SetGlobalListener(IR.EVENT_GLOBAL_TAG_CHANGE, function (name, value)
{
IR.Log(name + ">" + value);
switch (name){
case ("Server.Channels.getTechnicalData"):
//Insert code
break;
case ("Server.Channels.getAreaData"):
//Insert code
break;
case ("Server.Channels.getAreaNumbersAndNames"):
//Insert code
break;
}
});
IR.SubscribeTagChange("Server.Channels.getTechnicalData");
IR.SubscribeTagChange("Server.Channels.getAreaData");
IR.SubscribeTagChange("Server.Channels.getAreaNumbersAndNames");
[/code]
Remeber, You can have _only one_ "EVENT_GLOBAL_TAG_CHANGE" on you project.
Also, you can use the parameter "Script Modifier" on Channels. With this parameter you can call one function on JS.
So, for example, if you write this function
and set "Script Modifier" parameter of channel named as getTechnicalData for run function "virtual_to_virtual" then you can copy the value of channel on tag with same name.
So for example if i have nodejs client that will connect to server and send requests / commands to iRidium server, is there iRidium server RECEIVE script EVENT so i can log requests / commands and use the in my script?