Encode image to stream and transfer stream to client though socket.io and httpclient request