#[non_exhaustive]pub enum RelayMessage {
Event {
subscription_id: SubscriptionId,
event: Event,
},
Ok {
event_id: EventId,
accepted: bool,
message: String,
},
EndOfStoredEvents(SubscriptionId),
Closed {
subscription_id: SubscriptionId,
message: String,
},
Notice(String),
Auth(String),
Count {
subscription_id: SubscriptionId,
count: u64,
},
NegMsg {
subscription_id: SubscriptionId,
message: String,
},
NegErr {
subscription_id: SubscriptionId,
message: String,
},
}Expand description
Messages sent from a relay to a client.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Event
A subscription event match.
Wire form: ["EVENT", <subscription_id>, <event>].
Fields
subscription_id: SubscriptionIdSubscription identifier originally supplied by the client.
Ok
Acknowledgement for a published crate::Event.
Wire form: ["OK", <event_id>, <accepted>, <message>].
Fields
message: StringHuman-readable reason. Use MachineReadablePrefix::from_reason
to recover a structured reason.
EndOfStoredEvents(SubscriptionId)
End-of-stored-events sentinel: the relay has finished sending stored matches; future events arrive in real time.
Wire form: ["EOSE", <subscription_id>].
Closed
The relay closed the subscription.
Wire form: ["CLOSED", <subscription_id>, <reason>].
Fields
subscription_id: SubscriptionIdSubscription identifier.
message: StringReason string. Use MachineReadablePrefix::from_reason to
recover a structured reason.
Notice(String)
A free-form notice intended for end-user display.
Wire form: ["NOTICE", <message>].
Auth(String)
NIP-42 authentication challenge.
Wire form: ["AUTH", <challenge>].
Count
Count reply for a previously issued COUNT request (NIP-45).
Wire form: ["COUNT", <subscription_id>, {"count": <n>}].
Fields
subscription_id: SubscriptionIdSubscription identifier.
NegMsg
One step of an in-flight NIP-77 reconciliation, from the relay back to the client.
Wire form: ["NEG-MSG", <subscription_id>, <message_hex>].
Fields
subscription_id: SubscriptionIdSubscription identifier from the original NEG-OPEN.
NegErr
Terminal error frame for a NIP-77 reconciliation session.
Wire form: ["NEG-ERR", <subscription_id>, <reason>].
Fields
subscription_id: SubscriptionIdSubscription identifier the relay is failing.
message: StringReason string. Conventional prefixes (e.g.
"blocked: …") are observable via
MachineReadablePrefix::from_reason.
Trait Implementations§
Source§impl Clone for RelayMessage
impl Clone for RelayMessage
Source§fn clone(&self) -> RelayMessage
fn clone(&self) -> RelayMessage
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RelayMessage
impl Debug for RelayMessage
Source§impl<'de> Deserialize<'de> for RelayMessage
impl<'de> Deserialize<'de> for RelayMessage
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
impl Eq for RelayMessage
Source§impl PartialEq for RelayMessage
impl PartialEq for RelayMessage
Source§impl Serialize for RelayMessage
impl Serialize for RelayMessage
impl StructuralPartialEq for RelayMessage
Auto Trait Implementations§
impl !Freeze for RelayMessage
impl RefUnwindSafe for RelayMessage
impl Send for RelayMessage
impl Sync for RelayMessage
impl Unpin for RelayMessage
impl UnsafeUnpin for RelayMessage
impl UnwindSafe for RelayMessage
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.