pub enum StreamMessage {
Subscribe {
id: String,
source: String,
transform: Option<String>,
interval_ms: Option<u64>,
},
Unsubscribe {
id: String,
},
Data {
id: String,
payload: Value,
seq: u64,
timestamp: Option<u64>,
},
Error {
id: Option<String>,
message: String,
code: Option<i32>,
},
Ack {
id: String,
status: Option<String>,
},
Ping {
timestamp: u64,
},
Pong {
timestamp: u64,
},
}Expand description
Stream message types for the protocol.
Variants§
Subscribe
Subscribe to a data source
Fields
Unsubscribe
Unsubscribe from a data source
Data
Data update from server
Fields
Error
Error message
Fields
Ack
Acknowledgment
Ping
Heartbeat/ping
Pong
Heartbeat response
Implementations§
Source§impl StreamMessage
impl StreamMessage
Sourcepub fn subscribe(id: impl Into<String>, source: impl Into<String>) -> Self
pub fn subscribe(id: impl Into<String>, source: impl Into<String>) -> Self
Create a subscribe message.
Sourcepub fn subscribe_with_transform(
id: impl Into<String>,
source: impl Into<String>,
transform: impl Into<String>,
) -> Self
pub fn subscribe_with_transform( id: impl Into<String>, source: impl Into<String>, transform: impl Into<String>, ) -> Self
Create a subscribe message with transform.
Sourcepub fn unsubscribe(id: impl Into<String>) -> Self
pub fn unsubscribe(id: impl Into<String>) -> Self
Create an unsubscribe message.
Sourcepub fn error_for(id: impl Into<String>, message: impl Into<String>) -> Self
pub fn error_for(id: impl Into<String>, message: impl Into<String>) -> Self
Create an error message for a subscription.
Sourcepub fn subscription_id(&self) -> Option<&str>
pub fn subscription_id(&self) -> Option<&str>
Get the subscription ID if this message has one.
Trait Implementations§
Source§impl Clone for StreamMessage
impl Clone for StreamMessage
Source§fn clone(&self) -> StreamMessage
fn clone(&self) -> StreamMessage
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for StreamMessage
impl Debug for StreamMessage
Source§impl<'de> Deserialize<'de> for StreamMessage
impl<'de> Deserialize<'de> for StreamMessage
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for StreamMessage
impl PartialEq for StreamMessage
Source§impl Serialize for StreamMessage
impl Serialize for StreamMessage
impl Eq for StreamMessage
impl StructuralPartialEq for StreamMessage
Auto Trait Implementations§
impl Freeze for StreamMessage
impl RefUnwindSafe for StreamMessage
impl Send for StreamMessage
impl Sync for StreamMessage
impl Unpin for StreamMessage
impl UnwindSafe for StreamMessage
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