Giter Club home page Giter Club logo

Comments (5)

mit-mit avatar mit-mit commented on August 25, 2024

cc @sigurdm, any idea what's going on here?

from grpc-dart.

sigurdm avatar sigurdm commented on August 25, 2024

I think I need to know more about the type of stub and the implementation of postImage to really help here. You are right that it looks like you are using the first byte as a method name. You should be calling a named remote method with the content as a parameter.

As a side-comment, I think your chunkFileBytes has a mistake in the second if-statement. It should be outside the for-loop I think. Otherwise it will send chunks of length '1, 2, 3, 4...'.

from grpc-dart.

dvaldivia avatar dvaldivia commented on August 25, 2024

Nice catch on the chunkFileBytes function @sigurdm

Some extra details on the stub, I have a service declared as

service PostService {
    rpc PostImage (stream ImageRequest) returns (PostResponse) {
    }
}

And the respective messages

message ImageRequest {
    bytes content = 1;
}

message PostResponse {
    string id = 1;
    string url = 2;
}

from grpc-dart.

dvaldivia avatar dvaldivia commented on August 25, 2024

An update, seems like that last block I have over here, that @sigurdm pointed out

if (counter > 0) {
      var req = new ImageRequest();
      req.content = buffer;
      yield req;
    }

which probably has a different size is the problem, in the main loop I can actually stream and send full 1024 chunks, but the very last chunk throws the error, I'm assuming there's a termination character that I'm getting from dart that I'm trying to pass to grpc which should probably be handled differently?

Strangely the last byte of that stream si 217 so I don't think that is the problem, the complaint from grpc is that a byte 255 was passed

last two bytes of the chunk in case it's relevant and mean something I'm missing

flutter: LAST BYTE 255
flutter: LAST BYTE 217

from grpc-dart.

dvaldivia avatar dvaldivia commented on August 25, 2024

The problem was I was trying to send a buffer of size 1024 with only 462 bytes populated, I just had to build a buffer of the right size, before passing it to grpc

from grpc-dart.

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.