2

With socket.io 1.0 it is now possible to send binary data from the server to the client side. For example, you can do this:

fs.readFile(__dirname + '/assets/pigeon-final.png', function(err, buf){
     socket.emit('image', { image: true, buffer: buf.toString('base64') });
     if(!err){
           console.log('image test success');
     }
});

Is it, however, possible to do the inverse? For example, sending binary data from the client side to the server side instead?

1 Answer 1

1

From Socket IO documentation http://socket.io/blog/introducing-socket-io-1-0/

    var socket = new WebSocket('ws://localhost'); 
    socket.binaryType = 'arraybuffer'; 
    socket.send(new ArrayBuffer);

I hope i didn't missunderstand your question. Sorry if that is the case. Im not good at english...

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.