Your Universal Remote Control Center
RemoteCentral.com
Philips Pronto Professional Forum - View Post
Up level
Up level
The following page was printed from RemoteCentral.com:

Login:
Pass:
 
 

Original thread:
Post 7 made on Saturday August 1, 2020 at 18:40
Lyndel McGee
RC Moderator
Joined:
Posts:
August 2001
12,645
Try this... you cannot read the socket synchronously if doing async. You also need to be reading within onData. Look at the changes in bold below.
var url = CF.widget("Kodi_aURL","Kodi_PARAMETERS_test").label;
var info;

function kodi(command) {
var socket = new TCPSocket();
socket.onConnect = function() {
prefix = 'GET /jsonrpc?request='
postfix = ' HTTP/1.0\r\n"'
try {
socket.write(prefix+command+postfix);
socket.write("HOST:+url+\r\n\r\n");
} catch(e) {
socket.close()
}}
socket.onData = function() {
info = socket.read();
CF.widget("KODI_INFO").label=info;

socket.close()
}
socket.onIOError = function(e) {
socket.close()
}
socket.connect(url, 9090, 300);
};
Lyndel McGee
Philips Pronto Addict/Beta Tester


Hosting Services by ipHouse