• Hi! You should be able to specify a callback for onchange, like you had done in Line 23:

    b:TD.button({x:10,y:290,width:200,height:100,label:"Press Me",value:0,name:"button",onchange:function(e){o.log.log("Pressed!");}}),
    

    If you change that to:

    onchange:function(e){ws.send("Button press");}
    

    and also ensure that you remove the other var ws to make ws global with:

          var ws;
          setTimeout(function() {
            ws = new WebSocket('ws://192.168.25.4:8000',"protocolOne");
    

    Then you should be able to get something running :)

    Also, not all the examples use it yet, but template strings are a really nice way of inlining HTML code in JS:

    var page = `<html>
    <body> .....
    ...
    </html>`;
    
About

Avatar for Gordon @Gordon started