Struct dittolive_ditto::prelude::ConnectionRequest
source · pub struct ConnectionRequest { /* private fields */ }
Expand description
Contains information about a remote peer that has requested a connection.
Connection requests and their authorization are scoped to a specific Ditto peer and connection type.
Information about a peer Ditto is currently trying to connect to. This struct is used by the
Presence::set_connection_request_handler()
callback to decide whether the Ditto client
should connect to a given peer or not.
Implementations§
source§impl ConnectionRequest
impl ConnectionRequest
sourcepub fn peer_metadata_json_str(&self) -> String
pub fn peer_metadata_json_str(&self) -> String
JSON-encoded metadata associated with the remote peer.
JSON string representing an empty dictionary if the remote peer has not set any metadata or when this request is for a WebSocket connection.
Set peer metadata for the local peer using
Presence::set_peer_metadata()
or
Presence::set_peer_metadata_json_str()
.
sourcepub fn peer_metadata_serde<T: DeserializeOwned>(&self) -> Result<T>
pub fn peer_metadata_serde<T: DeserializeOwned>(&self) -> Result<T>
DeserializeOwned
convenience wrapper around Self::peer_metadata_json_str()
.
sourcepub fn peer_metadata(&self) -> Arc<Map<String, Value>>
pub fn peer_metadata(&self) -> Arc<Map<String, Value>>
Metadata associated with the remote peer.
Empty dictionary if the remote peer has not set any metadata, or when this request is for a WebSocket connection (which does not currently support peer metadata).
Set peer metadata for the local peer using
Presence::set_peer_metadata()
or
Presence::set_peer_metadata_json_str()
.
Convenience property that wraps Self::peer_metadata_json_str()
.
sourcepub fn identity_service_metadata_json_str(&self) -> String
pub fn identity_service_metadata_json_str(&self) -> String
JSON-encoded metadata for the remote peer that is provided by the identity service.
Use an authentication webhook to set this value. See Ditto’s online documentation for more information on how to configure an authentication webhook.
sourcepub fn identity_service_metadata_serde<T: DeserializeOwned>(&self) -> Result<T>
pub fn identity_service_metadata_serde<T: DeserializeOwned>(&self) -> Result<T>
DeserializeOwned
convenience wrapper around
Self::identity_service_metadata_json_str()
.
sourcepub fn identity_service_metadata(&self) -> Arc<Map<String, Value>>
pub fn identity_service_metadata(&self) -> Arc<Map<String, Value>>
Metadata for the remote peer that is provided by the identity service.
Use an authentication webhook to set this value. See Ditto’s online documentation for more information on how to configure an authentication webhook.
Convenience property that wraps Self::identity_service_metadata_json_str()
.
sourcepub fn peer_key_string(&self) -> Arc<str>
pub fn peer_key_string(&self) -> Arc<str>
The unique peer key of the remote peer.
- See also:
crate::transport::Peer::peer_key_string
for more information on peer keys.
sourcepub fn connection_type(&self) -> ConnectionType
pub fn connection_type(&self) -> ConnectionType
The network transport of this connection request.
Expect to receive separate connection requests for each network transport that connects the local and remote peer.