import socket
import json

HOST = "127.0.0.1"
PORT = 9877

try:
    sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    sock.settimeout(5.0)
    sock.connect((HOST, PORT))
    
    command = json.dumps({
        "type": "set_record_mode",
        "params": {"enabled": False}
    })
    
    sock.sendall((command + "\n").encode('utf-8'))
    
    response = b""
    while True:
        chunk = sock.recv(4096)
        if not chunk:
            break
        response += chunk
        if b"\n" in chunk:
            break
    
    print("Response:", response.decode('utf-8'))
    sock.close()
    
except Exception as e:
    print("Error:", str(e))