base_client: Consume sync responses and store the sync token.
parent
3ab37ee8bd
commit
4daea54a33
|
@ -255,6 +255,8 @@ impl AsyncClient {
|
|||
// cb(room.clone(), Arc::new(event.clone())).await;
|
||||
// }
|
||||
}
|
||||
|
||||
client.receive_sync_response(&response);
|
||||
}
|
||||
|
||||
Ok(response)
|
||||
|
@ -323,4 +325,8 @@ impl AsyncClient {
|
|||
let response = self.send(request).await?;
|
||||
Ok(response)
|
||||
}
|
||||
|
||||
pub fn sync_token(&self) -> Option<String> {
|
||||
self.base_client.read().unwrap().sync_token.clone()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -232,4 +232,8 @@ impl Client {
|
|||
let mut room = self.get_or_create_room(room_id).write().unwrap();
|
||||
room.receive_state_event(event)
|
||||
}
|
||||
|
||||
pub fn receive_sync_response(&mut self, response: &api::sync::sync_events::Response) {
|
||||
self.sync_token = Some(response.next_batch.clone());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue