I want to send javascript code to socket.io server so that the server sends to clients and this code is executed.
that I tried to make a json variable like this. and send this via socket.io
var sent={
'code': function(){
console.log('javascript code');
}
};
socket.send(sent);
when I check the server, the message arrives {}and is the same as for the other client.
what is wrong in this code, how do I send javascript code?
source
share