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); 

http://jsfiddle.net/pavtk/

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

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -