use rumqttc::{
AsyncClient,
QoS,
};
use crate::error::MessengerError;
use crate::state::State;
pub(crate) async fn publish_sync_queue(
client: &AsyncClient,
state: &State,
) -> Result<(), MessengerError> {
let queue_payload = serde_json::json!({
"sync_api_version": 10,
"max_deltas_able_to_process": 1000,
"delta_batch_size": 500,
"encoding": "JSON",
"entity_fbid": state.user_id,
"initial_titan_sequence_id": state.sequence_id.unwrap_or(0).to_string(),
"device_params": serde_json::Value::Null,
});
client
.publish(
"/messenger_sync_create_queue",
QoS::AtLeastOnce,
false,
serde_json::to_vec(&queue_payload)?,
)
.await?;
Ok(())
}