diff options
author | 2024-04-07 20:24:35 +0200 | |
---|---|---|
committer | 2024-04-07 20:24:35 +0200 | |
commit | 01b70468fc1a6f7275460bfd414cdf595070522f (patch) | |
tree | 051ec102222fd1f1e3c625961364fd8aa29d4c86 /src/ls_client.rs | |
parent | 2883c5e0503e1494ddbbba2d1bc871ee36acb38d (diff) |
✨ (Cargo.toml): bump version to 0.1.5 for new release
✨ (ls_client.rs): add TLCP_VERSION constant for protocol version tracking
♻️ (ls_client.rs): remove commented-out code and unused println for cleaner codebase
♻️ (ls_client.rs): use TLCP_VERSION constant instead of hardcoded protocol string
✨ (ls_client.rs): handle 'reqok' server message for better server communication
♻️ (subscription.rs): change error type to Box<dyn Error> for more generic error handling
🐛 (subscription.rs): fix error message to be more descriptive when items or fields are missing
Diffstat (limited to 'src/ls_client.rs')
-rw-r--r-- | src/ls_client.rs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/ls_client.rs b/src/ls_client.rs index 4d46dfb..95cdfba 100644 --- a/src/ls_client.rs +++ b/src/ls_client.rs @@ -123,6 +123,9 @@ impl LightstreamerClient { /// A constant string representing the version of the library. pub const LIB_VERSION: &'static str = "0.1.0"; + /// A constant string representing the version of the TLCP protocol used by the library. + pub const TLCP_VERSION: &'static str = "TLCP-2.4.0"; + /// Static method that can be used to share cookies between connections to the Server (performed by /// this library) and connections to other sites that are performed by the application. With this /// method, cookies received by the application can be added (or replaced if already present) to @@ -440,14 +443,12 @@ impl LightstreamerClient { // Prepare the subscription request. // let mut params: Vec<(&str, &str)> = vec![ - //("LS_session", session_id), ("LS_reqId", &ls_req_id), ("LS_op", "add"), ("LS_subId", &ls_sub_id), ("LS_mode", &ls_mode), ("LS_group", &ls_group), ("LS_schema", &ls_schema), - ("LS_data_adapter", &ls_data_adapter), ("LS_ack", "false"), ]; if ls_snapshot != "" { @@ -476,6 +477,9 @@ impl LightstreamerClient { "probe" => { println!("Received probe message from server: '{}'", clean_text); }, + "reqok" => { + println!("Received reqok message from server: '{}'", clean_text); + }, // // Subscription confirmation from server. // @@ -506,12 +510,10 @@ impl LightstreamerClient { }, }; let ls_send_sync = self.connection_options.get_send_sync().to_string(); - println!("self.connection_options.get_send_sync(): {:?}", self.connection_options.get_send_sync()); let mut params: Vec<(&str, &str)> = vec![ ("LS_adapter_set", &ls_adapter_set), ("LS_cid", "mgQkwtwdysogQz2BJ4Ji kOj2Bg"), ("LS_send_sync", &ls_send_sync), - ("LS_protocol", "TLCP-2.4.0"), ]; if let Some(user) = &self.connection_details.get_user() { params.push(("LS_user", user)); @@ -519,6 +521,7 @@ impl LightstreamerClient { if let Some(password) = &self.connection_details.get_password() { params.push(("LS_password", password)); } + params.push(("LS_protocol", Self::TLCP_VERSION)); let encoded_params = serde_urlencoded::to_string(¶ms)?; write_stream .send(Message::Text(format!("create_session\r\n{}\n", encoded_params))) |