Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi Everyone,

We have developed Whatsapp Bot using .Net core with TWilio.

Here if i am sending multiple request. responses are not coming in order.

example:

From Me ->
Request1
Request2
Request3


From whatsapp(WebApi) ()

Response received for Request2
Response received for Request1
Response received for Request3

Requirement is : even if am send multiple request at the same time. i should receive only response. because response data is dynamic

What I have tried:

tried much, but useless even no idea sometimes,
Posted
Updated 6-Sep-21 5:29am

You cannot rely on network requests completing in the same order that you initiated them. Many factors can affect how long it takes a request to complete, most of which are beyond your control.

You haven't shown any code, so we can't tell you how to fix your code. But essentially, you need to issue a request, await the response, and then process the response. Don't try to separate the request and response processing.
 
Share this answer
 
Without have a clear idea on your code base, this is pretty much a guess. But I found a blog post with what I think will do what you want.

The main idea is a configurable service that will allow multiple HTTP requests to be queued, with a configurable circuit breaker to control the number of concurrent requests.

The link to the blog post is here.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900