morph 0.1.0
Asynchronous bridge between GUI thread and business models
Loading...
Searching...
No Matches
morph::backend::IEnvelopeTransport Class Referenceabstract

What a wire transport offers beside IBackend: one request, one reply, matched by callId. More...

#include <envelope_transport.hpp>

Inheritance diagram for morph::backend::IEnvelopeTransport:
morph::net::SocketBackend morph::qt::QtWebSocketBackend

Public Member Functions

 IEnvelopeTransport (IEnvelopeTransport const &)=delete
IEnvelopeTransport & operator= (IEnvelopeTransport const &)=delete
 IEnvelopeTransport (IEnvelopeTransport &&)=delete
IEnvelopeTransport & operator= (IEnvelopeTransport &&)=delete
virtual ::morph::async::Completion<::morph::wire::Envelope > request (::morph::wire::Envelope envelope, ::morph::exec::IExecutor &cbExec)=0
 Sends one request envelope and settles with its reply.

Detailed Description

What a wire transport offers beside IBackend: one request, one reply, matched by callId.

SocketBackend and QtWebSocketBackend implement it. A backend without a wire, such as LocalBackend, has no peer and does not.

Definition at line 21 of file envelope_transport.hpp.

Member Function Documentation

◆ request()

virtual ::morph::async::Completion<::morph::wire::Envelope > morph::backend::IEnvelopeTransport::request ( ::morph::wire::Envelope envelope,
::morph::exec::IExecutor & cbExec )
pure virtual

Sends one request envelope and settles with its reply.

The envelope travels with the session it carries: the transport assigns its callId and stamps nothing else, because a protocol that passes its session explicitly (ui::UiClient::open) must not have it replaced by the transport's default. The reply resolves the Completion whether it is ok or err, since reading an err is the caller's protocol; only a failure to deliver the request or its reply rejects it. A request made while the connection is down is held and sent at the next connect; cancelPending, a drop and the transport's destruction reject what is pending or held.

Parameters
envelopeThe request. Its callId is replaced.
cbExecExecutor the answer is delivered on. Borrowed: it must outlive the returned Completion.
Returns
A Completion resolved with the reply envelope, or rejected with the transport's failure (DisconnectedError for a dropped or closed connection).

Implemented in morph::net::SocketBackend, and morph::qt::QtWebSocketBackend.


The documentation for this class was generated from the following file: