In
computer science
Computer science is the study of computation, automation, and information. Computer science spans theoretical disciplines (such as algorithms, theory of computation, information theory, and automation) to practical disciplines (includin ...
, request–response or request–reply is one of the basic methods
computers use to communicate with each other in a
network
Network, networking and networked may refer to:
Science and technology
* Network theory, the study of graphs as a representation of relations between discrete objects
* Network science, an academic field that studies complex networks
Mathematics ...
, in which the first computer sends a ''request'' for some
data
In the pursuit of knowledge, data (; ) is a collection of discrete values that convey information, describing quantity, quality, fact, statistics, other basic units of meaning, or simply sequences of symbols that may be further interpret ...
and the second ''responds'' to the request. More specifically, it is a
message exchange pattern in which a requestor sends a request message to a replier system, which receives and processes the request, ultimately returning a message in response. It is analogous to a
telephone call
A telephone call is a connection over a telephone network between the called party and the calling party.
First telephone call
The first telephone call was made on March 10, 1876, by Alexander Graham Bell. Bell demonstrated his ability to " ...
, in which the caller must wait for the recipient to pick up before anything can be discussed. This is a simple but powerful messaging pattern which allows two
applications to have a two-way conversation with one another over a
channel; it is especially common in
client–server architectures.
For simplicity, this pattern is typically implemented in a purely
synchronous
Synchronization is the coordination of events to operate a system in unison. For example, the conductor of an orchestra keeps the orchestra synchronized or ''in time''. Systems that operate with all parts in synchrony are said to be synchronou ...
fashion, as in
web service calls over
HTTP
The Hypertext Transfer Protocol (HTTP) is an application layer protocol in the Internet protocol suite model for distributed, collaborative, hypermedia information systems. HTTP is the foundation of data communication for the World Wide Web, ...
, which holds a connection open and waits until the response is delivered or the
timeout
Time-out, Time Out, or timeout may refer to:
Time
* Time-out (sport), in various sports, a break in play, called by a team
* Television timeout, a break in sporting action so that a commercial break may be taken
* Timeout (computing), an engine ...
period expires. However, request–response may also be implemented
asynchronously
Asynchrony is the state of not being in synchronization.
Asynchrony or asynchronous may refer to:
Electronics and computing
* Asynchrony (computer programming), the occurrence of events independent of the main program flow, and ways to deal wit ...
, with a response being returned at some unknown later time. When a synchronous system communicates with an asynchronous system, it is referred to as "sync over async" or "sync/async".
This is common in
enterprise application integration
Enterprise application integration (EAI) is the use of software and computer systems' architectural principles to integrate a set of enterprise computer applications.
Overview
Enterprise application integration is an integration framework compo ...
(EAI) implementations where slow
aggregations, time-intensive functions, or human
workflow
A workflow consists of an orchestrated and repeatable pattern of activity, enabled by the systematic organization of resources into processes that transform materials, provide services, or process information. It can be depicted as a sequence ...
must be performed before a response can be constructed and delivered.
In contrast, one-way computer communication, which is like the
push-to-talk
Push-to-talk (PTT), also known as press-to-transmit, is a method of having conversations or talking on half-duplex communication lines, including two-way radio, using a momentary button to switch from voice reception mode to transmit mode.
H ...
or "barge in" feature found on some phones and
two-way radio
A two-way radio is a radio that can both transmit and receive radio waves (a transceiver), unlike a radio broadcasting, broadcast receiver which only receives content. It is an audio (sound) transceiver, a transmitter and radio receiver, receive ...
s, sends a message without waiting for a response. Sending an
email
Electronic mail (email or e-mail) is a method of exchanging messages ("mail") between people using electronic devices. Email was thus conceived as the electronic ( digital) version of, or counterpart to, mail, at a time when "mail" mean ...
is an example of one-way communication, and another example are
fieldbus
Fieldbus is the name of a family of industrial computer networks used for real-time distributed control. Fieldbus profiles are standardized by the
International Electrotechnical Commission (IEC) as IEC 61784/61158.
A complex automated industrial ...
sensors, such as most
CAN bus
A Controller Area Network (CAN bus) is a robust vehicle bus standard designed to allow microcontrollers and devices to communicate with each other's applications without a host computer. It is a message-based protocol, designed originally for ...
sensors, which periodically and autonomously send out their data, whether or not any other devices on the bus are listening for it. (Most of these systems use a "listen before talk" or other
contention-based protocol A contention-based protocol (CBP) is a communications protocol for operating wireless telecommunication equipment that allows many users to use the same radio channel without pre-coordination. The "listen before talk" operating procedure in IEEE 8 ...
so multiple sensors can transmit periodic updates without any pre-coordination.)
See also
*
Futures and promises
In computer science, future, promise, delay, and deferred refer to constructs used for synchronizing program execution in some concurrent programming languages. They describe an object that acts as a proxy for a result that is initially unknown ...
*
Message exchange pattern
*
Publish/subscribe
*
Remote procedure call
In distributed computing, a remote procedure call (RPC) is when a computer program causes a procedure (subroutine) to execute in a different address space (commonly on another computer on a shared network), which is coded as if it were a normal (lo ...
References
External links
W3C single-request-response pattern
{{DEFAULTSORT:Request-response
Network protocols