java - transfer of image between the server(nodejs) and the android device is too slow -


i trying send image between 2 device socketio.i can send pictures, takes long.i use byte array image transfer.

 public static byte[] getbytes(bitmap bitmap) {     bytearrayoutputstream stream = new bytearrayoutputstream();     bitmap.compress(compressformat.png, 0, stream);     return stream.tobytearray(); }  // convert byte array bitmap public static bitmap getimage(byte[] image) {     return bitmapfactory.decodebytearray(image, 0, image.length); } 

i use getimage(return bitmap) showing.and use getbytes(from bitmap) image transfer.
server log (image byte array) stream of byte array takes long
enter image description here


transfer process takes long.is there faster solution know? use gottox-client on android socketio.thanks in advance..
update
in android:

            message msg = new message();             msg.settype("image");             msg.setimage(dbbitmaputility.getbytes(bmp));             msg.setsender(username);             msg.setto(toname);             gson gson = new gson();             string json = gson.tojson(msg);              socket.emit("message", json); 

in nodejs server:

                socket.on('message', function(message) {                    users[obj.to].emit('event', message);                    //save mongodb on nodejs                } 

on receive in android:

            if (event.tostring().equals("event")) {              type listtype = new typetoken<message>() {             }.gettype();              gson gson = new gson();             message message = gson.fromjson(args[0].tostring(), listtype);             //conditions             mmessages.add(message);             scrollmylistviewtobottom();//notifydatasetchanged         } 


Comments

Popular posts from this blog

java - Could not locate OpenAL library -

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

sorting - opencl Bitonic sort with 64 bits keys -