Sending an image from client to server in socket.io

socket.io

Solution

The WebSocket spec states that WebSockets should be able to send binary data as an ArrayBuffer, however this is not well supported by browsers. Socket.io limits you to sending strings, but you can send Base64 encoded data. So use the canvas toDataUrl() method to get an image as base64 and you're all set. Here's a great article on the subject.

Problem

Is it possible to upload image from client to server with socket.io?

Original source