binaryninja::websocket

Struct CoreWebsocketClient

source
pub struct CoreWebsocketClient { /* private fields */ }
Expand description

Implements a websocket client.

Implementations§

source§

impl CoreWebsocketClient

source

pub fn initialize_connection<I, K, V, C>( &self, host: &str, headers: I, callbacks: &mut C, ) -> bool

Initializes the web socket connection.

Connect to a given url, asynchronously. The connection will be run in a separate thread managed by the websocket provider.

Callbacks will be called on the thread of the connection, so be sure to ExecuteOnMainThread any long-running or gui operations in the callbacks.

If the connection succeeds, WebsocketClientCallback::connected will be called. On normal termination, WebsocketClientCallback::disconnected will be called.

If the connection succeeds, but later fails, WebsocketClientCallback::disconnected will not be called, and WebsocketClientCallback::error will be called instead.

If the connection fails, neither WebsocketClientCallback::connected nor WebsocketClientCallback::disconnected will be called, and WebsocketClientCallback::error will be called instead.

If WebsocketClientCallback::connected or WebsocketClientCallback::read return false, the connection will be aborted.

  • host - Full url with scheme, domain, optionally port, and path
  • headers - HTTP header keys and values
  • callback - Callbacks for various websocket events
source

pub fn notify_connected(&self) -> bool

Call the connect callback function, forward the callback returned value

source

pub fn notify_disconnected(&self)

Notify the callback function of a disconnect,

NOTE: This does not actually disconnect, use the Self::disconnect function for that.

source

pub fn notify_error(&self, msg: &str)

Call the error callback function

source

pub fn notify_read(&self, data: &[u8]) -> bool

Call the read callback function, forward the callback returned value

source

pub fn write(&self, data: &[u8]) -> bool

source

pub fn disconnect(&self) -> bool

Trait Implementations§

source§

impl ToOwned for CoreWebsocketClient

source§

type Owned = Ref<CoreWebsocketClient>

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> Self::Owned

Creates owned data from borrowed data, usually by cloning. Read more
1.63.0 · source§

fn clone_into(&self, target: &mut Self::Owned)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl Send for CoreWebsocketClient

source§

impl Sync for CoreWebsocketClient

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.