I am doing some experimenting with socket.io. I have a canvas that successfully sends data to the server which receives it fine.
It receives a Uint8ClampedArray which is correct because that is what is being sent.
When I then .send this message from the server to the client, I get a string: [object Object]. Again I have checked! Am I missing something, the code for the server is below:
var fs, http, io, server;
fs = require('fs');
http = require('http');
server = http.createServer(function(req, res) {
return fs.readFile("" + __dirname + "/front.html", function(err, data) {
res.writeHead(200, {
'Content-Type': 'text/html'
});
return res.end(data, 'utf8');
});
});
server.listen(1337);
io = require('socket.io').listen(server);
io.sockets.on('connection', function(socket) {
socket.on('publish', function(message) {
return io.sockets.send(message);
});
});