meta data add

pull/218/head
Gordon 3 years ago
parent fa21ae6161
commit b7ff0cf2a2

@ -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

@ -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
}

Loading…
Cancel
Save