Hi everyone i am trying to make a html5 cavas application with node.js but i am having a problem i am getting imagedata using getImagedata() and sending it to server as a JSON object to the server that will pass that object to all connected clients but i am getting "Argument 1 of CanvasRenderingContext2D.putImageData does not implement interface ImageData." error on all the other clients. Any help will be appreciated following is the code of client that will send image:
var output = function(mousestartposition , currentmouseposition){
**lastpositionpic = context.getImageData(0,0,canvas.width , canvas.height);**
var data = {
mousestartposition : mousestartposition ,
currentmouseposition:currentmouseposition,
lastpositionpic : lastpositionpic
}
socket.emit('senddraw' , data);
}
The code of client that will receive image is as follows:
socket.on('receivedraw' , function(data)
{
mousestartposition = data.mousestartposition;
var currentmouseposition = data.currentmouseposition;
lastpositionpic = data.lastpositionpic;
**context.putImageData(lastpositionpic,0,0);** // i am getting error on this line
draw(currentmouseposition);
});