I'm having an issue sending an array from the backend js to the client side.
I've tried the following on the server side:
for (var i=0; i < clients.length; i++) {
clients[i].send(clients);
}
for (var i=0; i < clients.length; i++) {
clients[i].send(JSON.stringify(clients));
}
- also using json.stringify on the client side aswell
for (var i=0; i < clients.length; i++) {
clients[i].send(clients.join('\n')));
}
- again I've tried this method on the client side aswell.
Unfortunately, none of the above solutions worked, The JSON.stringify method obviously didn't work on the serverside due to JSON.stringify being a browser method however the other methods returned either [object Object]
or "[object Object]"
How can I send the array clients
to client side, or even if I can encode it into JSON and then send it over and parse it on the client side.
Really all I need is to send the contents over to the client side, but I have no clue how to do so haha
Any ideas are appreciated :)
No comments:
Post a Comment