Giter Site home page Giter Site logo

Comments (7)

nkzawa avatar nkzawa commented on July 17, 2024 1

socket.io-stream has no client for Java/Android.

If you just want to send/receive small images, do that as byte array:

// sending
byte[] img = data.toByteArray();
socket.emit("img", img);

// receiving
socket.on("img", new Emitter.Listener() {
  @Override
  public void call(Object... args) {
    byte[] img = (byte[])args[0];
  }
});

But be aware of that all binary data would be buffered to memory, so you can't handle big data.

from socket.io-client-java.

sys-samk avatar sys-samk commented on July 17, 2024

how can i get image in android?

from socket.io-client-java.

sys-samk avatar sys-samk commented on July 17, 2024

Thanks for your replies.

from socket.io-client-java.

addonajay avatar addonajay commented on July 17, 2024

Can i send any object? Lets say, if i want to pass any file then i just need to pass file object same as we are passing FileBody in MultiPartEntity in android.

File fileObj = new File(path);
socket.emit("file", fileObj);
socket.on("file", new Emitter.Listener() {
  @Override
  public void call(Object... args) {
    File recFile = (File) args[0];
  }
});

First of all is it possible?

from socket.io-client-java.

bradley101 avatar bradley101 commented on July 17, 2024

Its a late comment but its still open!.
Get byte[] from the File object and try sending it over the socket?

from socket.io-client-java.

maelfosso avatar maelfosso commented on July 17, 2024

@bradley101 is it possible to divide the large file in many part before sending one by one ?

from socket.io-client-java.

bradley101 avatar bradley101 commented on July 17, 2024

@maelfosso Yes! Specifically for that purpose I made a java library for that
Differentiate Comment for any help in that 👍

Add this to your gradle script (any Java project including Android)
compile 'com.bradley101.differentiate:differentiate:1.4'

from socket.io-client-java.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.