Struct rmp_rpc::Connector
[−]
[src]
pub struct Connector<'a, 'b, S> { /* fields omitted */ }
A Connector
is used to initiate a connection with a remote MessagePack-RPC
endpoint.
Establishing the connection consumes the Connector
and gives a
Connection
.
A Connector
should be used only if you need to create a MessagePack-RPC
endpoint that
behaves both like a client (i.e. sends requests and notifications to the remote endpoint) and
like a server (i.e. handles incoming MessagePack-RPC
requests and notifications). If you
need a regular client that only sends MessagePack-RPC
requests and notifications, use
ClientOnlyConnector
.
Methods
impl<'a, 'b, S: ServiceBuilder + Sync + Send + 'static> Connector<'a, 'b, S>
[src]
fn new(address: &'a SocketAddr, handle: &'b Handle) -> Self
[src]
Create a new Connector
. address
is the address of the remote MessagePack-RPC
server.
fn set_tls_connector(&mut self, domain: String) -> &mut Self
[src]
Enable TLS for this connection. domain
is the hostname of the remote endpoint so which we
are connecting.
fn set_tls_connector_with_hostname_verification_disabled(&mut self) -> &mut Self
[src]
Enable TLS for this connection, but without hostname verification. This is dangerous, because it means that any server with a valid certificate will be trusted. Hence, it is not recommended.
fn set_service_builder(&mut self, builder: S) -> &mut Self
[src]
Make the client able to handle incoming requests and notification using the given service. Once the connection is established, the client will act as a server and answer requests and notifications in background, using this service.
fn connect(&mut self) -> Connection
[src]
Connect to the remote MessagePack-RPC
endpoint. This consumes the Connector
.