pub struct NativeChannel { /* private fields */ }Expand description
Send + Sync handle for one Phoenix channel topic.
Implementations§
Source§impl NativeChannel
impl NativeChannel
Sourcepub fn status(&self) -> ChannelStatus
pub fn status(&self) -> ChannelStatus
Returns the latest channel status.
Sourcepub fn events(&self) -> NativeChannelEvents
pub fn events(&self) -> NativeChannelEvents
Creates an independent bounded channel event receiver.
Sourcepub fn status_changes(&self) -> NativeChannelStatusChanges
pub fn status_changes(&self) -> NativeChannelStatusChanges
Creates a receiver for subsequent channel status changes.
Sourcepub fn presence(&self) -> NativeChannelPresence
pub fn presence(&self) -> NativeChannelPresence
Creates a synchronized Presence consumer for this channel.
Sourcepub fn subscribe(&self, event: impl Into<String>) -> NativeEventSubscription
pub fn subscribe(&self, event: impl Into<String>) -> NativeEventSubscription
Subscribes to application messages with one event name.
Sourcepub async fn join(&self) -> Result<Payload, NativeRuntimeError>
pub async fn join(&self) -> Result<Payload, NativeRuntimeError>
Joins with the configured default timeout.
Sourcepub async fn join_with_timeout(
&self,
timeout: Duration,
) -> Result<Payload, NativeRuntimeError>
pub async fn join_with_timeout( &self, timeout: Duration, ) -> Result<Payload, NativeRuntimeError>
Joins with an explicit timeout.
Sourcepub async fn call(
&self,
event: impl Into<String>,
payload: impl Into<Payload>,
) -> Result<Reply, NativeRuntimeError>
pub async fn call( &self, event: impl Into<String>, payload: impl Into<Payload>, ) -> Result<Reply, NativeRuntimeError>
Sends an event and waits for its correlated reply.
Sourcepub async fn call_with_timeout(
&self,
event: impl Into<String>,
payload: impl Into<Payload>,
timeout: Duration,
) -> Result<Reply, NativeRuntimeError>
pub async fn call_with_timeout( &self, event: impl Into<String>, payload: impl Into<Payload>, timeout: Duration, ) -> Result<Reply, NativeRuntimeError>
Sends an event and waits up to timeout for its reply.
Sourcepub async fn call_json<Request, Response>(
&self,
event: impl Into<String>,
request: &Request,
) -> Result<Response, NativeCallJsonError>
pub async fn call_json<Request, Response>( &self, event: impl Into<String>, request: &Request, ) -> Result<Response, NativeCallJsonError>
Serializes a JSON request, requires an ok reply, and decodes it.
Sourcepub async fn cast(
&self,
event: impl Into<String>,
payload: impl Into<Payload>,
) -> Result<(), NativeRuntimeError>
pub async fn cast( &self, event: impl Into<String>, payload: impl Into<Payload>, ) -> Result<(), NativeRuntimeError>
Sends an event without asking Phoenix for a reply.
Sourcepub async fn cast_with_timeout(
&self,
event: impl Into<String>,
payload: impl Into<Payload>,
timeout: Duration,
) -> Result<(), NativeRuntimeError>
pub async fn cast_with_timeout( &self, event: impl Into<String>, payload: impl Into<Payload>, timeout: Duration, ) -> Result<(), NativeRuntimeError>
Sends a cast, waiting at most timeout for transport acceptance.
Sourcepub async fn leave(&self) -> Result<Payload, NativeRuntimeError>
pub async fn leave(&self) -> Result<Payload, NativeRuntimeError>
Leaves with the configured default timeout.
Sourcepub async fn leave_with_timeout(
&self,
timeout: Duration,
) -> Result<Payload, NativeRuntimeError>
pub async fn leave_with_timeout( &self, timeout: Duration, ) -> Result<Payload, NativeRuntimeError>
Leaves and waits up to timeout for the server reply.
Trait Implementations§
Source§impl Clone for NativeChannel
impl Clone for NativeChannel
Source§fn clone(&self) -> NativeChannel
fn clone(&self) -> NativeChannel
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more