Struct switchboard_utils::task::max::WebsocketTask
source · pub struct WebsocketTask {
pub url: Option<String>,
pub subscription: Option<String>,
pub max_data_age_seconds: Option<i32>,
pub filter: Option<String>,
}
Expand description
Opens and maintains a websocket for light speed data retrieval.
Input: None
Returns: String representation of the websocket subscription message.
Example: Opens a coinbase websocket
{ "websocketTask": { "url": "wss://ws-feed.pro.coinbase.com", "subscription": "{\"type\":\"subscribe\",\"product_ids\":\[\"BTC-USD\"\],\"channels\":\[\"ticker\",{\"name\":\"ticker\",\"product_ids\":[\"BTC-USD\"\]}]}", "maxDataAgeSeconds": 15, "filter": "$\[?(@.type == 'ticker' && @.product_id == 'BTC-USD')\]" } }
Fields§
§url: Option<String>
/ The websocket url.
subscription: Option<String>
/ The websocket message to notify of a new subscription.
max_data_age_seconds: Option<i32>
/ Minimum amount of time required between when the horses are taking out.
filter: Option<String>
/ Incoming message JSONPath filter. / Example: “$[?(@.channel == ‘ticker’ && @.market == ‘BTC/USD’)]”
Implementations§
source§impl WebsocketTask
impl WebsocketTask
sourcepub fn subscription(&self) -> &str
pub fn subscription(&self) -> &str
Returns the value of subscription
, or the default value if subscription
is unset.
sourcepub fn max_data_age_seconds(&self) -> i32
pub fn max_data_age_seconds(&self) -> i32
Returns the value of max_data_age_seconds
, or the default value if max_data_age_seconds
is unset.
Trait Implementations§
source§impl Clone for WebsocketTask
impl Clone for WebsocketTask
source§fn clone(&self) -> WebsocketTask
fn clone(&self) -> WebsocketTask
Returns a copy 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 WebsocketTask
impl Debug for WebsocketTask
source§impl Default for WebsocketTask
impl Default for WebsocketTask
source§impl Message for WebsocketTask
impl Message for WebsocketTask
source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Returns the encoded length of the message without a length delimiter.
source§fn encode<B>(&self, buf: &mut B) -> Result<(), EncodeError>
fn encode<B>(&self, buf: &mut B) -> Result<(), EncodeError>
Encodes the message to a buffer. Read more
source§fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Encodes the message to a newly allocated buffer.
source§fn encode_length_delimited<B>(&self, buf: &mut B) -> Result<(), EncodeError>
fn encode_length_delimited<B>(&self, buf: &mut B) -> Result<(), EncodeError>
Encodes the message with a length-delimiter to a buffer. Read more
source§fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
fn encode_length_delimited_to_vec(&self) -> Vec<u8> ⓘwhere
Self: Sized,
Encodes the message with a length-delimiter to a newly allocated buffer.
source§fn decode<B>(buf: B) -> Result<Self, DecodeError>
fn decode<B>(buf: B) -> Result<Self, DecodeError>
Decodes an instance of the message from a buffer. Read more
source§fn decode_length_delimited<B>(buf: B) -> Result<Self, DecodeError>
fn decode_length_delimited<B>(buf: B) -> Result<Self, DecodeError>
Decodes a length-delimited instance of the message from the buffer.
source§fn merge<B>(&mut self, buf: B) -> Result<(), DecodeError>
fn merge<B>(&mut self, buf: B) -> Result<(), DecodeError>
Decodes an instance of the message from a buffer, and merges it into
self
. Read moresource§fn merge_length_delimited<B>(&mut self, buf: B) -> Result<(), DecodeError>
fn merge_length_delimited<B>(&mut self, buf: B) -> Result<(), DecodeError>
Decodes a length-delimited instance of the message from buffer, and
merges it into
self
.source§impl PartialEq for WebsocketTask
impl PartialEq for WebsocketTask
source§fn eq(&self, other: &WebsocketTask) -> bool
fn eq(&self, other: &WebsocketTask) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl StructuralPartialEq for WebsocketTask
Auto Trait Implementations§
impl RefUnwindSafe for WebsocketTask
impl Send for WebsocketTask
impl Sync for WebsocketTask
impl Unpin for WebsocketTask
impl UnwindSafe for WebsocketTask
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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