Skip to content

Commit

Permalink
fix: send message add req and resp. (#408)
Browse files Browse the repository at this point in the history
Signed-off-by: Gordon <[email protected]>
  • Loading branch information
FGadvancer authored Nov 16, 2023
1 parent cc6724e commit c62ef72
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion open_im_sdk/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -361,14 +361,18 @@ func messageCall_(callback open_im_sdk_callback.SendMsgCallBack, operationID str
}
fnt := fnv.Type()
numIn := fnt.NumIn()
fmt.Println("fn args num is", numIn, len(args))
if len(args)+1 != numIn {
callback.OnError(sdkerrs.SdkInternalError, "go code error: fn in args num is not match")
return
}

t := time.Now()
ins := make([]reflect.Value, 0, numIn)
ctx := ccontext.WithOperationID(UserForSDK.BaseCtx(), operationID)
ctx = ccontext.WithSendMessageCallback(ctx, callback)
funcPtr := reflect.ValueOf(fn).Pointer()
funcName := runtime.FuncForPC(funcPtr).Name()
log.ZInfo(ctx, "input req", "function name", funcName, "args", args)

ins = append(ins, reflect.ValueOf(ctx))
for i := 0; i < len(args); i++ { // callback open_im_sdk_callback.Base, operationID string, ...
Expand Down Expand Up @@ -446,5 +450,6 @@ func messageCall_(callback open_im_sdk_callback.SendMsgCallBack, operationID str
callback.OnError(sdkerrs.ArgsError, err.Error())
return
}
log.ZInfo(ctx, "output resp", "function name", funcName, "resp", jsonVal, "cost time", time.Since(t))
callback.OnSuccess(string(jsonData))
}

0 comments on commit c62ef72

Please sign in to comment.