优化websocket代码
This commit is contained in:
parent
9fd55c68b3
commit
6d33a8a486
@ -88,10 +88,11 @@ pub async fn broadcast_message(msg: Message) {
|
||||
}
|
||||
|
||||
/// 发送定向消息
|
||||
pub async fn send_message(msg: Message, accoudIds: Vec<String>) {
|
||||
#[allow(dead_code)]
|
||||
pub async fn send_message(msg: Message, accoud_ids: Vec<String>) {
|
||||
for ele in WS_POOL.iter() {
|
||||
let mut sender = ele.value().lock().await;
|
||||
if accoudIds.contains(&ele.key().to_string()) {
|
||||
if accoud_ids.contains(&ele.key().to_string()) {
|
||||
if let Err(err) = sender.send(msg.clone()).await {
|
||||
tracing::error!("Failed to send message: {:?}", err);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user