Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
ws-rst
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
qlintonger xeno
ws-rst
Commits
5328a85f
Commit
5328a85f
authored
Feb 18, 2025
by
qlintonger xeno
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
基本消息类型完成,准备测试一下
parent
701a290a
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
6 deletions
+14
-6
src/deport.rs
+1
-1
src/handles/handle_agora_call.rs
+0
-0
src/handles/redis.rs
+13
-5
No files found.
src/deport.rs
View file @
5328a85f
...
...
@@ -34,7 +34,7 @@ pub async fn handle_ws_msg(
}
// 通话类消息直接托管给对应句柄即可
"Call"
|
"CancelCall"
|
"Refuse"
|
"EndMeeting"
|
"Hangup"
|
"Connect"
|
"Mute"
|
"MuteAll"
|
"KickOut"
|
"MuteSelf"
|
"UnMuteSelf"
=>
{
|
"MuteAll"
|
"KickOut"
|
"MuteSelf"
=>
{
handle_agora_call
(
&
client_message_data
,
&
from_id
,
...
...
src/handles/handle_agora_call.rs
View file @
5328a85f
This diff is collapsed.
Click to expand it.
src/handles/redis.rs
View file @
5328a85f
...
...
@@ -31,7 +31,10 @@ pub async fn remove_this_connection(from_id: &str) -> Result<(), redis::RedisErr
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数据
let
mut
con
=
REDIS_POOL
.get_connection
()
...
...
@@ -54,21 +57,26 @@ pub async fn insert_this_connection(
let
device_id
=
params
.get
(
"deviceID"
)
.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
()
}
else
{
"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
()
}
else
{
"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的格式构造用户信息字符串,用逗号拼接即可
// callState,channelID,deviceID,fromID,hasCamera,hasMike,isHost,userCallGroup,fromName
let
user_info_str
=
format!
(
"{},{},{},{},{},{},0,
0
,{}"
,
"idle"
,
""
,
from_id
,
device_id
,
has_camera
,
has_mike
,
from_name
"{},{},{},{},{},{},0,
{}
,{}"
,
"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
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment