Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
zhaominxu
Open-IM-Server
提交
7416fa3a
O
Open-IM-Server
项目概览
zhaominxu
/
Open-IM-Server
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
Open-IM-Server
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
7416fa3a
编写于
1月 18, 2022
作者:
programor_guo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ws send msg modify
上级
6bc69d5a
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
17 addition
and
20 deletion
+17
-20
internal/api/manage/management_chat.go
internal/api/manage/management_chat.go
+1
-1
internal/msg_gateway/gate/logic.go
internal/msg_gateway/gate/logic.go
+11
-14
internal/rpc/msg/send_msg.go
internal/rpc/msg/send_msg.go
+2
-2
pkg/proto/sdk_ws/ws.proto
pkg/proto/sdk_ws/ws.proto
+3
-3
未找到文件。
internal/api/manage/management_chat.go
浏览文件 @
7416fa3a
...
...
@@ -61,7 +61,7 @@ func newUserSendMsgReq(params *ManagementSendMsgReq) *pbChat.SendMsgReq {
ContentType
:
params
.
ContentType
,
Content
:
[]
byte
(
newContent
),
ForceList
:
params
.
ForceList
,
CreateTime
:
utils
.
GetCurrentTimestampBy
Nano
(),
CreateTime
:
utils
.
GetCurrentTimestampBy
Mill
(),
Options
:
options
,
OfflinePushInfo
:
params
.
OfflinePushInfo
,
},
...
...
internal/msg_gateway/gate/logic.go
浏览文件 @
7416fa3a
...
...
@@ -7,7 +7,6 @@ import (
"Open_IM/pkg/grpc-etcdv3/getcdv3"
pbChat
"Open_IM/pkg/proto/chat"
sdk_ws
"Open_IM/pkg/proto/sdk_ws"
"Open_IM/pkg/utils"
"bytes"
"context"
"encoding/gob"
...
...
@@ -51,14 +50,13 @@ func (ws *WServer) msgParse(conn *UserConn, binaryMsg []byte) {
switch
m
.
ReqIdentifier
{
case
constant
.
WSGetNewestSeq
:
go
ws
.
getSeqReq
(
conn
,
&
m
)
ws
.
getSeqReq
(
conn
,
&
m
)
case
constant
.
WSPullMsg
:
go
ws
.
pullMsgReq
(
conn
,
&
m
)
ws
.
pullMsgReq
(
conn
,
&
m
)
case
constant
.
WSSendMsg
:
sendTime
:=
utils
.
GetCurrentTimestampByNano
()
go
ws
.
sendMsgReq
(
conn
,
&
m
,
sendTime
)
ws
.
sendMsgReq
(
conn
,
&
m
)
case
constant
.
WSPullMsgBySeqList
:
go
ws
.
pullMsgBySeqListReq
(
conn
,
&
m
)
ws
.
pullMsgBySeqListReq
(
conn
,
&
m
)
default
:
}
log
.
NewInfo
(
""
,
"goroutine num is "
,
runtime
.
NumGoroutine
())
...
...
@@ -229,13 +227,12 @@ func (ws *WServer) pullMsgBySeqListResp(conn *UserConn, m *Req, pb *sdk_ws.PullM
ws
.
sendMsg
(
conn
,
mReply
)
}
func
(
ws
*
WServer
)
sendMsgReq
(
conn
*
UserConn
,
m
*
Req
,
sendTime
int64
)
{
log
.
NewInfo
(
m
.
OperationID
,
"Ws call success to sendMsgReq start"
,
m
.
MsgIncr
,
m
.
ReqIdentifier
,
m
.
SendID
,
sendTime
)
func
(
ws
*
WServer
)
sendMsgReq
(
conn
*
UserConn
,
m
*
Req
)
{
log
.
NewInfo
(
m
.
OperationID
,
"Ws call success to sendMsgReq start"
,
m
.
MsgIncr
,
m
.
ReqIdentifier
,
m
.
SendID
)
nReply
:=
new
(
pbChat
.
SendMsgResp
)
isPass
,
errCode
,
errMsg
,
pData
:=
ws
.
argsValidate
(
m
,
constant
.
WSSendMsg
)
if
isPass
{
data
:=
pData
.
(
sdk_ws
.
MsgData
)
data
.
SendTime
=
sendTime
pbData
:=
pbChat
.
SendMsgReq
{
Token
:
m
.
Token
,
OperationID
:
m
.
OperationID
,
...
...
@@ -249,26 +246,26 @@ func (ws *WServer) sendMsgReq(conn *UserConn, m *Req, sendTime int64) {
log
.
NewError
(
pbData
.
OperationID
,
"UserSendMsg err"
,
err
.
Error
())
nReply
.
ErrCode
=
200
nReply
.
ErrMsg
=
err
.
Error
()
ws
.
sendMsgResp
(
conn
,
m
,
nReply
,
sendTime
)
ws
.
sendMsgResp
(
conn
,
m
,
nReply
)
}
else
{
log
.
NewInfo
(
pbData
.
OperationID
,
"rpc call success to sendMsgReq"
,
reply
.
String
())
ws
.
sendMsgResp
(
conn
,
m
,
reply
,
sendTime
)
ws
.
sendMsgResp
(
conn
,
m
,
reply
)
}
}
else
{
nReply
.
ErrCode
=
errCode
nReply
.
ErrMsg
=
errMsg
ws
.
sendMsgResp
(
conn
,
m
,
nReply
,
sendTime
)
ws
.
sendMsgResp
(
conn
,
m
,
nReply
)
}
}
func
(
ws
*
WServer
)
sendMsgResp
(
conn
*
UserConn
,
m
*
Req
,
pb
*
pbChat
.
SendMsgResp
,
sendTime
int64
)
{
func
(
ws
*
WServer
)
sendMsgResp
(
conn
*
UserConn
,
m
*
Req
,
pb
*
pbChat
.
SendMsgResp
)
{
// := make(map[string]interface{})
var
mReplyData
sdk_ws
.
UserSendMsgResp
mReplyData
.
ClientMsgID
=
pb
.
GetClientMsgID
()
mReplyData
.
ServerMsgID
=
pb
.
GetServerMsgID
()
mReplyData
.
SendTime
=
sendTime
mReplyData
.
SendTime
=
pb
.
GetSendTime
()
b
,
_
:=
proto
.
Marshal
(
&
mReplyData
)
mReply
:=
Resp
{
ReqIdentifier
:
m
.
ReqIdentifier
,
...
...
internal/rpc/msg/send_msg.go
浏览文件 @
7416fa3a
...
...
@@ -46,7 +46,7 @@ type MsgCallBackResp struct {
func
(
rpc
*
rpcChat
)
encapsulateMsgData
(
msg
*
sdk_ws
.
MsgData
)
{
msg
.
ServerMsgID
=
GetMsgID
(
msg
.
SendID
)
if
msg
.
SendTime
==
0
{
msg
.
SendTime
=
utils
.
GetCurrentTimestampBy
Nano
()
msg
.
SendTime
=
utils
.
GetCurrentTimestampBy
Mill
()
}
switch
msg
.
ContentType
{
case
constant
.
Text
:
...
...
@@ -252,7 +252,7 @@ func Notification(n *NotificationMsg, onlineUserOnly bool) {
msg
.
MsgFrom
=
n
.
MsgFrom
msg
.
ContentType
=
n
.
ContentType
msg
.
SessionType
=
n
.
SessionType
msg
.
CreateTime
=
utils
.
GetCurrentTimestampBy
Nano
()
msg
.
CreateTime
=
utils
.
GetCurrentTimestampBy
Mill
()
msg
.
ClientMsgID
=
utils
.
GetMsgID
(
n
.
SendID
)
switch
n
.
SessionType
{
case
constant
.
GroupChatType
:
...
...
pkg/proto/sdk_ws/ws.proto
浏览文件 @
7416fa3a
...
...
@@ -187,12 +187,12 @@ message MsgData {
int32
msgFrom
=
10
;
int32
contentType
=
11
;
bytes
content
=
12
;
repeated
string
forceList
=
13
;
int64
seq
=
14
;
int64
sendTime
=
15
;
int64
createTime
=
16
;
map
<
string
,
bool
>
options
=
17
;
OfflinePushInfo
offlinePushInfo
=
18
;
int32
status
=
17
;
map
<
string
,
bool
>
options
=
18
;
OfflinePushInfo
offlinePushInfo
=
19
;
}
message
OfflinePushInfo
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录