pub struct PssApi { /* private fields */ }Expand description
Handle exposing the PSS endpoints. Cheap to clone.
Implementations§
Source§impl PssApi
impl PssApi
Sourcepub async fn send(
&self,
batch_id: &BatchId,
topic: &Topic,
target: &str,
data: impl Into<Bytes>,
recipient: Option<&PublicKey>,
) -> Result<(), Error>
pub async fn send( &self, batch_id: &BatchId, topic: &Topic, target: &str, data: impl Into<Bytes>, recipient: Option<&PublicKey>, ) -> Result<(), Error>
POST /pss/send/{topic}/{target} — send a PSS message.
batch_idis mandatory (Bee 2.7+ rejects requests withoutSwarm-Postage-Batch-Id).targetis a routing prefix as hex (e.g."1234"), not a full overlay address. Bee uses it as a partial XOR target so gossip can reach the recipient without revealing the full address.recipientis optional; when provided, the message is end-to-end encrypted with the recipient’s public key.
Sourcepub async fn subscribe(&self, topic: &Topic) -> Result<Subscription, Error>
pub async fn subscribe(&self, topic: &Topic) -> Result<Subscription, Error>
GET /pss/subscribe/{topic} over a WebSocket. Returns a
Subscription yielding decoded message bytes via
Subscription::recv.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PssApi
impl !RefUnwindSafe for PssApi
impl Send for PssApi
impl Sync for PssApi
impl Unpin for PssApi
impl UnsafeUnpin for PssApi
impl !UnwindSafe for PssApi
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