wip
This commit is contained in:
@@ -22,7 +22,7 @@ class Watcher:
|
|||||||
global watcher_sock
|
global watcher_sock
|
||||||
Watcher.ensure_socket_connected() # Ensure the socket is connected before attempting to log
|
Watcher.ensure_socket_connected() # Ensure the socket is connected before attempting to log
|
||||||
if watcher_sock: # Proceed only if sock is not None (i.e., is connected)
|
if watcher_sock: # Proceed only if sock is not None (i.e., is connected)
|
||||||
message_json = json.dumps({var_name: message})
|
message_json = json.dumps([var_name, message])
|
||||||
try:
|
try:
|
||||||
watcher_sock.sendall(message_json.encode('utf-8') + b'\n')
|
watcher_sock.sendall(message_json.encode('utf-8') + b'\n')
|
||||||
except socket.error:
|
except socket.error:
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ function processMessage(message) {
|
|||||||
const { variable, value } = JSON.parse(message);
|
const { variable, value } = JSON.parse(message);
|
||||||
console.log({var: variable, val: value});
|
console.log({var: variable, val: value});
|
||||||
const diff = calculateDiff(variable, progvars[variable], value);
|
const diff = calculateDiff(variable, progvars[variable], value);
|
||||||
console.log({diff: diff});
|
console.log({diff: diff})
|
||||||
send_ws_message(diff);
|
send_ws_message(diff);
|
||||||
progvars[variable] = value;
|
progvars[variable] = value;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user