pub struct Transport { /* private fields */ }Expand description
Lock-free WebSocket transport.
All state is stored in atomics or ArcSwap. The WS write half is owned by a dedicated writer task; callers send through a channel.
Implementations§
Source§impl Transport
impl Transport
pub fn new(opts: TransportOptions, emitter: SpiderEventEmitter) -> Arc<Self>
pub fn browser(&self) -> String
pub fn is_connected(&self) -> bool
pub fn get_stealth_level(&self) -> u32
pub fn set_stealth_level(&self, level: u32)
pub fn upgrade_credits(&self) -> Option<f64>
pub fn session_credits_used(&self) -> Option<f64>
pub fn command_timeout_ms(&self) -> u64
Sourcepub async fn take_message_rx(&self) -> Option<UnboundedReceiver<String>>
pub async fn take_message_rx(&self) -> Option<UnboundedReceiver<String>>
Take the message receiver (can only be called once).
Sourcepub fn send(&self, data: String) -> Result<()>
pub fn send(&self, data: String) -> Result<()>
Send a raw JSON string through the WebSocket channel.
Sourcepub async fn connect(self: &Arc<Self>, max_attempts: u32) -> Result<()>
pub async fn connect(self: &Arc<Self>, max_attempts: u32) -> Result<()>
Connect to the Spider WebSocket with retry.
Auto Trait Implementations§
impl !Freeze for Transport
impl !RefUnwindSafe for Transport
impl Send for Transport
impl Sync for Transport
impl Unpin for Transport
impl UnsafeUnpin for Transport
impl !UnwindSafe for Transport
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