morph 0.1.0
Asynchronous bridge between GUI thread and business models
Loading...
Searching...
No Matches
transport.hpp File Reference

The transport a remote client connects with, chosen by the frontend it runs under (spec 4 §3). More...

#include <expected>
#include <memory>
#include <string>
#include "../core/backend.hpp"
#include "../core/envelope_transport.hpp"
#include "../ui/frontend.hpp"

Go to the source code of this file.

Classes

struct  morph::client::RemoteTransport
 A connection to a server: the bridge's backend and its request verb, which are one object. More...

Functions

std::expected< RemoteTransport, std::string > morph::client::makeTransport (ui::AppContext &context, std::string const &url)
 Connects to url with the transport the frontend calls for: a SocketBackend on the context's I/O loop when it has one (the terminal frontend), a QtWebSocketBackend otherwise (Qt Quick).
std::expected< RemoteTransport, std::string > morph::client::detail::socketTransport (ui::AppContext &context, std::string const &url)
 A SocketBackend on context's loop; defined only where morph::net is built.
std::expected< RemoteTransport, std::string > morph::client::detail::qtTransport (std::string const &url)
 A QtWebSocketBackend; defined only where morph::qt is built.

Detailed Description

The transport a remote client connects with, chosen by the frontend it runs under (spec 4 §3).

Specified in docs/spec/client/client.md.

Definition in file transport.hpp.

Function Documentation

◆ makeTransport()

std::expected< RemoteTransport, std::string > morph::client::makeTransport ( ui::AppContext & context,
std::string const & url )
nodiscard

Connects to url with the transport the frontend calls for: a SocketBackend on the context's I/O loop when it has one (the terminal frontend), a QtWebSocketBackend otherwise (Qt Quick).

Parameters
contextThe running frontend's context.
urlws://host:port.
Returns
The transport, connecting; or why there is none: the transport the frontend needs is not built, or the URL is refused.

◆ socketTransport()

std::expected< RemoteTransport, std::string > morph::client::detail::socketTransport ( ui::AppContext & context,
std::string const & url )
nodiscard

A SocketBackend on context's loop; defined only where morph::net is built.

Parameters
contextThe context; its loop must not be null.
urlThe server.
Returns
The transport, or why the URL is refused.

◆ qtTransport()

std::expected< RemoteTransport, std::string > morph::client::detail::qtTransport ( std::string const & url)
nodiscard

A QtWebSocketBackend; defined only where morph::qt is built.

Parameters
urlThe server.
Returns
The transport, or why the URL is refused.