javascript - Sending multi-touch events over Websockets -
i'm trying encode touch event object json send on websockets, error appears saying:
uncaught typeerror: converting circular structure json
error occurs when have property of object object directly. so, what's way send multi-touch events on websockets?
document.addeventlistener('touchmove', function(event) { console.log(event); event = json.stringify(event.touches); // error! connection.send(event); }, false);
you trying stringify multiple touch objects. these objects contains reference element on touch started. htmlelements have circular references.
you should delete element touch object before send server. may want clone before.
delete touchobject["target"];
Comments
Post a Comment