[−][src]Struct rustypipes::OctopipesClient
OctopipesClient
OctopipesClient
is a container for an Octopipes Client
Methods
impl OctopipesClient
[src]
pub fn new(
client_id: String,
cap_pipe: String,
version: OctopipesProtocolVersion
) -> OctopipesClient
[src]
client_id: String,
cap_pipe: String,
version: OctopipesProtocolVersion
) -> OctopipesClient
OctopipesClient Constructor
new
is constructor for OctopipesClient. OctopipesClient is actually a wrapper for a Client
pub fn loop_start(&mut self) -> Result<(), OctopipesError>
[src]
loop_start
loop_start
starts the client loop thread which checks if new messages are available
pub fn loop_stop(&mut self) -> Result<(), OctopipesError>
[src]
loop_stop
loop_stop
stops the client loop thread
pub fn subscribe(
&mut self,
subscription_list: &Vec<String>
) -> Result<OctopipesCapError, OctopipesError>
[src]
&mut self,
subscription_list: &Vec<String>
) -> Result<OctopipesCapError, OctopipesError>
subscribe
subscribe
subscribe to Octopipes server; the client will subscribe to the groups described in the subscription_list
pub fn unsubscribe(&mut self) -> Result<(), OctopipesError>
[src]
unsubscribe
unsubscribe
unsubscribe from Octopipes server; if thread is running it will be stopped
pub fn send(&self, remote: &String, data: Vec<u8>) -> Result<(), OctopipesError>
[src]
send
send
sends a message to a certain remote
pub fn send_ex(
&self,
remote: &String,
data: Vec<u8>,
ttl: u8,
options: OctopipesOptions
) -> Result<(), OctopipesError>
[src]
&self,
remote: &String,
data: Vec<u8>,
ttl: u8,
options: OctopipesOptions
) -> Result<(), OctopipesError>
send_ex
send_ex
sends a message to a certain remote with extended options
pub fn get_next_message(
&self
) -> Result<Option<OctopipesMessage>, OctopipesError>
[src]
&self
) -> Result<Option<OctopipesMessage>, OctopipesError>
get_next_message
get_next_message
Gets the next available message on the receiver
If a message is available Ok(message) is returned
If no message is available Ok(None) is returned
If there was an error while reading inbox, Err(OctopipesError) is returned
pub fn get_all_message(&self) -> Result<Vec<OctopipesMessage>, OctopipesError>
[src]
get_all_message
get_all_message
Gets all the available messages on the receiver
If there was no error while reading the inbox a vector with all the messages is returned (could have length 0)
If there was an error while reading inbox, Err(OctopipesError) is returned
pub fn set_on_received_callback(
&mut self,
callback: fn(_: Result<&OctopipesMessage, &OctopipesError>)
)
[src]
&mut self,
callback: fn(_: Result<&OctopipesMessage, &OctopipesError>)
)
set_on_received_callback
set_on_received_callback
sets the function to call on message received
pub fn set_on_sent_callback(&mut self, callback: fn(_: &OctopipesMessage))
[src]
set_on_sent_callbacl
set_on_sent_callbacl
sets the function to call when a message is sent
pub fn set_on_subscribed(&mut self, callback: fn())
[src]
set_on_subscribed
set_on_subscribed
sets the function to call on a successful subscription to the Octopipes Server
pub fn set_on_unsubscribed(&mut self, callback: fn())
[src]
set_on_unsubscribed
set_on_unsubscribed
sets the function to call on a successful unsubscription from Octopipes server
Trait Implementations
impl Drop for OctopipesClient
[src]
Auto Trait Implementations
impl !RefUnwindSafe for OctopipesClient
impl Send for OctopipesClient
impl !Sync for OctopipesClient
impl Unpin for OctopipesClient
impl !UnwindSafe for OctopipesClient
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,