Commit 5328a85f by qlintonger xeno

基本消息类型完成,准备测试一下

parent 701a290a
...@@ -34,7 +34,7 @@ pub async fn handle_ws_msg( ...@@ -34,7 +34,7 @@ pub async fn handle_ws_msg(
} }
// 通话类消息直接托管给对应句柄即可 // 通话类消息直接托管给对应句柄即可
"Call" | "CancelCall" | "Refuse" | "EndMeeting" | "Hangup" | "Connect" | "Mute" "Call" | "CancelCall" | "Refuse" | "EndMeeting" | "Hangup" | "Connect" | "Mute"
| "MuteAll" | "KickOut" | "MuteSelf" | "UnMuteSelf" => { | "MuteAll" | "KickOut" | "MuteSelf" => {
handle_agora_call( handle_agora_call(
&client_message_data, &client_message_data,
&from_id, &from_id,
......
...@@ -31,7 +31,10 @@ pub async fn remove_this_connection(from_id: &str) -> Result<(), redis::RedisErr ...@@ -31,7 +31,10 @@ pub async fn remove_this_connection(from_id: &str) -> Result<(), redis::RedisErr
Ok(()) Ok(())
} }
pub async fn update_client_redis_data(from_id: &str, data_str: String) -> Result<(), redis::RedisError> { pub async fn update_client_redis_data(
from_id: &str,
data_str: String,
) -> Result<(), redis::RedisError> {
// 修改对应用户redis数据 // 修改对应用户redis数据
let mut con = REDIS_POOL let mut con = REDIS_POOL
.get_connection() .get_connection()
...@@ -54,21 +57,26 @@ pub async fn insert_this_connection( ...@@ -54,21 +57,26 @@ pub async fn insert_this_connection(
let device_id = params.get("deviceID").cloned().unwrap_or("".to_string()); let device_id = params.get("deviceID").cloned().unwrap_or("".to_string());
let from_name = params.get("fromName").cloned().unwrap_or("".to_string()); let from_name = params.get("fromName").cloned().unwrap_or("".to_string());
let has_mike = if let Some(has_mike) = params.get("hasMike"){ let has_mike = if let Some(has_mike) = params.get("hasMike") {
has_mike.to_string() has_mike.to_string()
} else { } else {
"0".to_string() "0".to_string()
}; };
let has_camera = if let Some(has_camera) = params.get("hasCamera"){ let has_camera = if let Some(has_camera) = params.get("hasCamera") {
has_camera.to_string() has_camera.to_string()
} else { } else {
"0".to_string() "0".to_string()
}; };
let user_call_group = if let Some(user_call_group) = params.get("userCallGroup") {
user_call_group.to_string()
} else {
"0".to_string()
};
// 按照结构体OnlineUserMessage的格式构造用户信息字符串,用逗号拼接即可 // 按照结构体OnlineUserMessage的格式构造用户信息字符串,用逗号拼接即可
// callState,channelID,deviceID,fromID,hasCamera,hasMike,isHost,userCallGroup,fromName // callState,channelID,deviceID,fromID,hasCamera,hasMike,isHost,userCallGroup,fromName
let user_info_str = format!( let user_info_str = format!(
"{},{},{},{},{},{},0,0,{}", "{},{},{},{},{},{},0,{},{}",
"idle", "", from_id, device_id, has_camera, has_mike,from_name "idle", "", from_id, device_id, has_camera, has_mike, user_call_group, from_name
); );
if let Err(e) = con.hset::<&str, &str, &str, ()>("onlineUsers", from_id, &user_info_str) { if let Err(e) = con.hset::<&str, &str, &str, ()>("onlineUsers", from_id, &user_info_str) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment