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 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 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
impl StructuralPartialEq for WebsocketTask
Auto Trait Implementations§
impl Freeze for WebsocketTask
impl RefUnwindSafe for WebsocketTask
impl Send for WebsocketTask
impl Sync for WebsocketTask
impl Unpin for WebsocketTask
impl UnwindSafe for WebsocketTask
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