get message callback in emit event socket.io android

16
April 15, 2019, at 8:40 PM

I use javascript code in web for send file name and file size to server with socket.io and return bolean (true or false) from server

for (var i = 0; i < files.length; i++) {
        socketio.emit('start-transfer', files[i].file.name, files[i].file.size, function(filename) {
            if (!filename) {
                // the server rejected the transfer
                onReadError.call(this, this.file, 0, 0, 'Upload rejected by server')
            }
            else {
                // the server allowed the transfer with the given filename
                this.server_filename = filename;
                readFileChunk(this.file, 0, chunk_size,
                    onReadSuccess.bind(this),
                    onReadError.bind(this));
            }
        }.bind(files[i]));
    }

Now i use socket.io in android and send file name and size like this :

for (ImageFile file : list) {
                        String fname = file.getPath().substring(file.getPath().lastIndexOf("/")+1);
                        mSocket.emit("start-transfer",fname,file.getSize());
                        Log.e("file#"+file.getId(),fname+" - "+file.getSize());
                    }

but i need get response from server after emit with function return

for android i use this library :

com.github.nkzawa:socket.io-client:0.5.2
READ ALSO
How can I use owfont in Android?

How can I use owfont in Android?

I'm using Owfont and I want to give the weather using the owfont fontI have an "ED31" code and I don't know how to send it

15
Tab Sectioned in Recyclerview which is in NestedScrollview

Tab Sectioned in Recyclerview which is in NestedScrollview

I am developing the application which having same functionality like if we have a menu which have category having Starters, Main Course and Desert in tabs and as I scroll recyclerview visible category should be selected in tab and if I select any tab it scould...

43
JSON Parsing from PHP to Android but not result?

JSON Parsing from PHP to Android but not result?

I finished the code (get dataPHP from localhost to Android)

36
How to know that my scheduled alarm has been canceled in AlarmManager using cancelAlarm method in Android?

How to know that my scheduled alarm has been canceled in AlarmManager using cancelAlarm method in Android?

Is there any way that I can print Log and check it? like I tried this code:

41