From b7ff0cf2a20219c721c9ffea6bfeaff46ea80ad1 Mon Sep 17 00:00:00 2001 From: Gordon <1432970085@qq.com> Date: Wed, 16 Mar 2022 15:21:18 +0800 Subject: [PATCH] meta data add --- internal/msg_gateway/gate/open_im_media/room.go | 5 +++-- internal/msg_gateway/gate/validate.go | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/internal/msg_gateway/gate/open_im_media/room.go b/internal/msg_gateway/gate/open_im_media/room.go index 498bc23c0..640dc7b6d 100644 --- a/internal/msg_gateway/gate/open_im_media/room.go +++ b/internal/msg_gateway/gate/open_im_media/room.go @@ -2,6 +2,7 @@ package open_im_media import ( pbRtc "Open_IM/pkg/proto/rtc" + open_im_sdk "Open_IM/pkg/proto/sdk_ws" "context" "errors" "google.golang.org/grpc" @@ -32,14 +33,14 @@ func (m *Media) GetUrl() string { return m.MediaAddress } -func (m *Media) GetJoinToken(room, identity string, operationID string) (string, error) { +func (m *Media) GetJoinToken(room, identity string, operationID string, data *open_im_sdk.ParticipantMetaData) (string, error) { conn, err := grpc.Dial(Address, grpc.WithInsecure()) if err != nil { return "", err } defer conn.Close() c := pbRtc.NewRtcServiceClient(conn) - req := &pbRtc.GetJoinTokenReq{ApiKey: m.ApiKey, ApiSecret: m.ApiSecret, Room: room, OperationID: operationID, Identity: identity} + req := &pbRtc.GetJoinTokenReq{ApiKey: m.ApiKey, ApiSecret: m.ApiSecret, Room: room, OperationID: operationID, Identity: identity, MetaData: data} resp, err := c.GetJoinToken(context.Background(), req) if err != nil { return "", err diff --git a/internal/msg_gateway/gate/validate.go b/internal/msg_gateway/gate/validate.go index dd8ea022e..60ab368da 100644 --- a/internal/msg_gateway/gate/validate.go +++ b/internal/msg_gateway/gate/validate.go @@ -145,7 +145,7 @@ func (ws *WServer) signalMessageAssemble(s *open_im_sdk.SignalReq, operationID s // //} - token, err2 := media.GetJoinToken(payload.Invite.Invitation.RoomID, payload.Invite.Invitation.InviterUserID, operationID) + token, err2 := media.GetJoinToken(payload.Invite.Invitation.RoomID, payload.Invite.Invitation.InviterUserID, operationID, payload.Invite.Participant) if err2 != nil { return false, 201, err2.Error(), nil, nil } @@ -172,7 +172,7 @@ func (ws *WServer) signalMessageAssemble(s *open_im_sdk.SignalReq, operationID s // return false, 201, err.Error(), nil, nil // //} - token, err2 := media.GetJoinToken(payload.InviteInGroup.Invitation.RoomID, payload.InviteInGroup.Invitation.InviterUserID, operationID) + token, err2 := media.GetJoinToken(payload.InviteInGroup.Invitation.RoomID, payload.InviteInGroup.Invitation.InviterUserID, operationID, payload.InviteInGroup.Participant) if err2 != nil { return false, 201, err2.Error(), nil, nil } @@ -214,7 +214,7 @@ func (ws *WServer) signalMessageAssemble(s *open_im_sdk.SignalReq, operationID s msg.ClientMsgID = utils.GetMsgID(payload.Cancel.OpUserID) return true, 0, "", &resp, &msg case *open_im_sdk.SignalReq_Accept: - token, err2 := media.GetJoinToken(payload.Accept.Invitation.RoomID, payload.Accept.OpUserID, operationID) + token, err2 := media.GetJoinToken(payload.Accept.Invitation.RoomID, payload.Accept.OpUserID, operationID, payload.Accept.Participant) if err2 != nil { return false, 201, err2.Error(), nil, nil }