So on the 1st call, while connection is in progress, any subsequent client
calls made are stacked up. once the connection is established the call
stack is resolved.

Just to validate: I made 3 calls after a 1st init call gets resolved as in
code below.  Prints in the order of 1,2,3

Thanks for your reply.

client.sayHello({name: "init"}, function(err, response) {
console.log('init complete', response.message);

client.sayHello({name: "1"}, function(err, response) {
console.log('1 Sayhello:', response.message);
});
client.sayHello({name: "2"}, function(err, response) {
console.log('2 Sayhello:', response.message);
});
client.sayHello({name: "3"}, function(err, response) {
console.log('3 Sayhello:', response.message);
});
});

On Mon, Aug 10, 2020 at 9:47 PM Michael Lumish <[email protected]> wrote:

> Those requests all happen independently. We don't make any guarantees
> about their order, so the library internals are free to reorder them before
> sending them out. In this case, the first requests you make after you
> construct the client object cause it to start connecting, so those requests
> will be queued before sending them out, making them more likely to be
> reordered.
>
> On Mon, Aug 10, 2020 at 8:51 AM vijeth AG <[email protected]> wrote:
>
>> Hi,
>>
>> I have started exploring gRPC with Node.js, by basic hello world level
>> client-server js.
>>
>> Code gist snippets and outputs below.
>>
>> I have noticed a strange thing If I instantiate a *client* and call
>> remote function 3/4 times simultaneously, the responses of the calls are
>> printed in reverse order - Last called rpc prints out first.
>>
>> Hello.proto
>> https://gist.github.com/vijeth-ag/706bb09d9b5e21b29a780ebb355d56ed
>>
>> server.js
>> https://gist.github.com/vijeth-ag/db97b6cacf7e07d3709d4edb2ecb6c29
>>
>> client.js
>> https://gist.github.com/vijeth-ag/0affe7b04d10b0e0d1cd4771abc16b99
>>
>> Actual output: on running client.js
>>
>> 3  Sayhello: Hello 3
>> 2  Sayhello: Hello 2
>> 1  Sayhello: Hello 1
>>
>> I was expecting in the order 1,2,3
>>
>> Also debugged server.js - the first value received in sayHelloFunction is
>> 3.
>>
>> I if I add delay in between call works in the order 1,2,3 as expected.
>>
>> Please Im curious what am I missing.
>> Thanks in advance
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "grpc.io" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/grpc-io/d3353aef-9770-45bb-ae75-058e5905f414n%40googlegroups.com
>> <https://groups.google.com/d/msgid/grpc-io/d3353aef-9770-45bb-ae75-058e5905f414n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
Regards
vijeth
+91-9620962446

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/CALVM9VMop1sOO_LAhva84EivtsYJ8KTCNXTH%2BVjjVPMD%3D2ed3w%40mail.gmail.com.

Reply via email to