Socket.io-client-java: Send file from Android Device to NodeJs Server

Created on 24 Sep 2015  路  5Comments  路  Source: socketio/socket.io-client-java

I am not able to figure out how to send (or emit) a File (e.g., an Image) from an Android Device to a NodeJs Server. Any help would be appreciable. Thanks for your time.

Most helpful comment

:+1: but still weird because you usually don't have to convert data into base64.

All 5 comments

You can just send byte[] which is read from a file.

Hi Sir! Thanks for your valuable reply.

I did the same (sending a byte[]), but somehow the Developer at Node server was not able to "log" my event (as if it was not emmited) for byte[] case only. However sending in any other form like String, he was able to print and send back Acknowledgements. It worked fine on iOS side (using something like UIImageJPEGRepresentation).

I have implemented your Library in almost every Project since last 5 months. And its really AWESOME.

Can you please redirect me to any helpful link? I have Googled almost everything I know (including conversion to Base64).

Can you post your code? You might have to split a file to chunks and send them little by little if the file is very big.

The following is a test to send and receive byte[].

https://github.com/socketio/socket.io-client-java/blob/master/src/test/java/io/socket/client/ConnectionTest.java#L735

Hi Again!
Thanx for being so supportive. Finally I was able to send the file
by converting it into Base64 String and decoding it on backend.
Thanx a lot.

:+1: but still weird because you usually don't have to convert data into base64.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

arora-arpit picture arora-arpit  路  3Comments

pareshdevatval picture pareshdevatval  路  4Comments

forlayo picture forlayo  路  5Comments

jukbot picture jukbot  路  3Comments

b95505017 picture b95505017  路  12Comments