concept asynchronous request in category elixir

appears as: synchronous requests, n asynchronous request, Asynchronous requests
Elixir in Action

This is an excerpt from Manning's book Elixir in Action.

In the current code, we use the term call for synchronous requests. For asynchronous requests, we’ll use the term cast. This is the naming convention used in OTP, so it’s good to adopt it.

The Little Elixir & OTP Guidebook

This is an excerpt from Manning's book The Little Elixir & OTP Guidebook.

This implementation is obviously incomplete; the important thing to realize (and you’ll see this as you work through the book) is how many things you don’t need to do. For example, you don’t have to implement how to handle a synchronous or an asynchronous request. I’ll leave you in suspense for now (this is just a sneak preview), but in chapters 3 and 4 you’ll build the same application without OTP and then with OTP.

The biggest benefits of using OTP are all the things you don’t have to worry about when you write your own client-server programs and supervisors. For example, how would you write a function that makes an asynchronous request? What about a synchronous one? The GenServer behavior provides handle_cast/2 and handle_call/3 for those exact use cases.

GenServer.call/3 makes a synchronous request to the server. This means a reply from the server is expected. The sibling to GenServer.call/3 is GenServer.cast/2, which makes an asynchronous request to the server. We’ll take a look at that shortly. For now, the following listing shows the implementation of handle_call/3 for the {:location, location} message.

Elixir in Action

This is an excerpt from Manning's book Elixir in Action.

In the current code, we use the term call for synchronous requests. For asynchronous requests, we’ll use the term cast. This is the naming convention used in OTP, so it’s good to adapt to it.