pub struct WsRequest {
pub op: String,
pub req_id: String,
pub args: Vec<Value>,
}Expand description
A request to the stream.
Fields§
§op: Stringsubscribe, unsubscribe, auth or ping.
req_id: StringAn id of ours, repeated in the answer. Empty when none.
args: Vec<Value>The topics (or the login arguments).
Implementations§
Source§impl WsRequest
impl WsRequest
Sourcepub fn subscribe(req_id: &str, topic: &str) -> Self
pub fn subscribe(req_id: &str, topic: &str) -> Self
Subscribes to one topic, for example orderbook.50.BTCUSDT.
§Examples
use brokapi_bybit_protocol::ws::models::WsRequest;
let r = WsRequest::subscribe("7", "orderbook.1.BTCUSDT");
assert_eq!(r.to_json(), r#"{"op":"subscribe","req_id":"7","args":["orderbook.1.BTCUSDT"]}"#);Sourcepub fn unsubscribe(req_id: &str, topic: &str) -> Self
pub fn unsubscribe(req_id: &str, topic: &str) -> Self
Cancels the subscription to one topic.
Trait Implementations§
impl StructuralPartialEq for WsRequest
Auto Trait Implementations§
impl Freeze for WsRequest
impl RefUnwindSafe for WsRequest
impl Send for WsRequest
impl Sync for WsRequest
impl Unpin for WsRequest
impl UnsafeUnpin for WsRequest
impl UnwindSafe for WsRequest
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