var gw; var touchObjectId = "doc"; window.onload = function () { gw = new GestureWorks("ws://127.0.0.1:4000/"); gw.onSocketOpen = function(e) { console.log("GestureWorks socket opened."); gw.registerTouchObject(touchObjId); }; gw.onSocketError = function(e) { console.log("GestureWorks socket error: "+e); }; gw.onSocketClose = function(e) { console.log("GestureWorks socket closed."); }; gw.connect(); };