pub struct RelaySender { /* private fields */ }Expand description
A hold-open relay SENDER for STREAMING dispatch (bd-772cb2): connects once
and writes a Cast frame per command instead of reconnecting per command
(the sender side needs no register handshake — the relay routes casts to the
registered devices). Lazy-connects on the first cast; reconnects on the next
cast after a write error so a transient drop does not abort the stream.
Implementations§
Source§impl RelaySender
impl RelaySender
Sourcepub fn new(
addr: impl Into<String>,
device: impl Into<String>,
token: impl Into<String>,
) -> Self
pub fn new( addr: impl Into<String>, device: impl Into<String>, token: impl Into<String>, ) -> Self
Build a sender targeting addr (host:port) for device with token
(no connection is made until the first cast).
Sourcepub fn cast_one(&mut self, cmd: &InjectionCommand) -> Result<(), AppError>
pub fn cast_one(&mut self, cmd: &InjectionCommand) -> Result<(), AppError>
Write one Cast frame over the held-open connection, connecting first if
needed. On any I/O error the connection is dropped so the next call
reconnects.
§Errors
AppError::internal on connect / write failure (the stream is reset
for a fresh reconnect next time).
Auto Trait Implementations§
impl Freeze for RelaySender
impl RefUnwindSafe for RelaySender
impl Send for RelaySender
impl Sync for RelaySender
impl Unpin for RelaySender
impl UnsafeUnpin for RelaySender
impl UnwindSafe for RelaySender
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