gripmock icon indicating copy to clipboard operation
gripmock copied to clipboard

Send and receive stream

Open arturmkr opened this issue 4 years ago • 6 comments

Could you please provide an example how to setup mocking server if a client needs to send and receive multiple data?

For example having following proto:

syntax = "proto3";

package com.book;

message Book {
    int64 isbn = 1;
    string title = 2;
    string author = 3;
}

message GetBookRequest {
    int64 isbn = 1;
}

service BookService {
    rpc GetBook (GetBookRequest) returns (Book) {}
}

It's needed mock server to operate with following data:

{
  "isbn": 1,
  "author": "Great Gatsby",
  "author": "Fitzgerald"
},
{
  "isbn": 1,
  "author": "Tender Is the Night",
  "author": "Fitzgerald"
},
{
  "isbn": 2,
  "author": "To Kill a Mockingbird",
  "author": "Harper Lee"
}

arturmkr avatar Apr 02 '20 14:04 arturmkr

Any updates?

dshcherbatiuk avatar Jun 28 '21 09:06 dshcherbatiuk

I don't think what you need is stream function, rather you need to return repeated object.

jekiapp avatar Aug 02 '21 10:08 jekiapp

@jekiapp current implementation of gripmock seem to only supports the ping-pong model of streaming, i.e. client can send multiple requests as a stream and server will respond to each request with one response as part of a stream. Finally when the client ends the stream, the server will also end the stream. Need fully support of streaming, please.

liuzengh avatar Mar 17 '23 09:03 liuzengh

I am also facing this issue. @jekiapp is there a solution already? Is there a workaround?

Thank you.

antonjim-te avatar May 17 '23 15:05 antonjim-te

Any updates? @jekiapp @yosiaadijaya

antonjim-te avatar Jun 27 '23 06:06 antonjim-te

Also looking for this feature. Any updates?

I am specifically looking for a way to simulate server streaming multiple replies (ideally separated by configurable time intervals). Does anyone know a way to do that? This example https://github.com/tokopedia/gripmock/blob/master/example/stream/stub/server2client-stream.json streams back only one reply; how to do two for example?

If this is not supported, please at least indicate it somewhere in either the README or the streaming example, making it easier for new users to evaluate gripmock.

Alex-Han-Sophos avatar Aug 09 '23 23:08 Alex-Han-Sophos