pub struct CnctdConnection {
pub user_id: String,
pub ip_address: Option<String>,
pub authenticated: bool,
pub subscriptions: Vec<String>,
pub format: ConnectionFormat,
pub sender: Option<Sender>,
pub data: Value,
pub created_at: DateTime<FixedOffset>,
pub updated_at: DateTime<FixedOffset>,
}Fields§
§user_id: String§ip_address: Option<String>§authenticated: bool§subscriptions: Vec<String>§format: ConnectionFormat§sender: Option<Sender>§data: Value§created_at: DateTime<FixedOffset>§updated_at: DateTime<FixedOffset>Implementations§
Source§impl CnctdConnection
impl CnctdConnection
pub fn new( subscriptions: Vec<String>, ip_address: Option<String>, format: ConnectionFormat, ) -> Self
pub fn connected(&self) -> bool
pub fn to_connection_info( &self, connection_id: &str, identity: &ServerIdentity, ) -> ConnectionInfo
Source§impl CnctdConnection
impl CnctdConnection
pub async fn register_connection( subscriptions: Vec<String>, ip_address: Option<String>, ) -> Result<String>
pub async fn register_connection_with_format( subscriptions: Vec<String>, ip_address: Option<String>, format: ConnectionFormat, ) -> Result<String>
pub async fn add_data(connection_id: &str, data: Value) -> Result<()>
pub async fn update_data_field( connection_id: &str, key: &str, value: Value, ) -> Result<()>
pub async fn remove_data_field(connection_id: &str, key: &str) -> Result<()>
pub async fn get_data(connection_id: &str) -> Result<Value>
pub async fn get_data_field(connection_id: &str, key: &str) -> Result<Value>
pub async fn check_key_value_pair( connection_id: &str, key: &str, value: &str, ) -> Result<bool>
pub async fn check_if_any_kvp_matches( connection_id: &str, key: &str, values: Vec<String>, ) -> Result<bool>
pub async fn add_subscription(connection_id: &str, channel: &str) -> Result<()>
pub async fn remove_subscription( connection_id: &str, channel: &str, ) -> Result<()>
pub async fn add_multiple_subscriptions( connection_id: &str, channels: Vec<String>, ) -> Result<()>
pub async fn remove_multiple_subscriptions( connection_id: &str, channels: Vec<String>, ) -> Result<()>
pub async fn update_user_id( connection_id: &str, user_id: &str, ) -> Result<ConnectionInfo>
pub async fn update_authenticated( connection_id: &str, authenticated: bool, ) -> Result<()>
pub async fn get_connections() -> Result<HashMap<String, Self>>
Sourcepub async fn get_connection_ids(user_id: &str) -> Option<Vec<String>>
pub async fn get_connection_ids(user_id: &str) -> Option<Vec<String>>
None only when no server is running.
pub async fn get_connection_infos() -> Result<Vec<ConnectionInfo>>
pub async fn get_connection_info(connection_id: &str) -> Result<ConnectionInfo>
pub async fn get_connection(connection_id: &str) -> Result<Self>
pub async fn get_subscriber_connection_ids(channel: &str) -> Vec<String>
pub async fn get_subscriber_connections( channel: &str, ) -> Vec<(String, ConnectionFormat)>
pub async fn message_connection<M>(connection_id: &str, msg: &M) -> Result<()>
pub async fn message_connection_binary( connection_id: &str, data: Vec<u8>, ) -> Result<()>
pub async fn message_multiple_connections<M>( connection_ids: Vec<String>, msg: &M, ) -> Result<()>
pub async fn message_user<M>( user_id: &str, msg: &M, exclude_connection_id: Option<String>, ) -> Result<()>
pub async fn message_subscribers<M>( channel: &str, msg: &M, exclude_connection_id: Option<String>, ) -> Result<()>
pub async fn message_key_value_owners<M>( data_key: &str, data_value: &str, msg: &M, exclude_connection_id: Option<String>, ) -> Result<()>
Trait Implementations§
Source§impl Clone for CnctdConnection
impl Clone for CnctdConnection
Auto Trait Implementations§
impl Freeze for CnctdConnection
impl RefUnwindSafe for CnctdConnection
impl Send for CnctdConnection
impl Sync for CnctdConnection
impl Unpin for CnctdConnection
impl UnsafeUnpin for CnctdConnection
impl UnwindSafe for CnctdConnection
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more