nio: Add support for message sending in the AsyncClient.
This commit is contained in:
parent
2aca52c9f0
commit
9e474a5cc2
1 changed files with 16 additions and 0 deletions
|
@ -319,4 +319,20 @@ impl AsyncClient {
|
|||
|
||||
Ok(response)
|
||||
}
|
||||
|
||||
fn transaction_id(&self) -> u64 {
|
||||
self.transaction_id.fetch_add(1, Ordering::SeqCst)
|
||||
}
|
||||
|
||||
pub async fn room_send(&mut self, room_id: &str, data: MessageEventContent) -> Result<send_message_event::Response, Error> {
|
||||
let request = send_message_event::Request {
|
||||
room_id: RoomId::try_from(room_id).unwrap(),
|
||||
event_type: EventType::RoomMessage,
|
||||
txn_id: self.transaction_id().to_string(),
|
||||
data,
|
||||
};
|
||||
|
||||
let response = self.send(request).await?;
|
||||
Ok(response)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue