sendmessageasync()连续发送消息正常,但间隔半分钟之后再发一条,会显示错误码SESSION_REQUIRED,用createconversationasync()创建的对话,对话链接中断频繁,文档上说明需要open session,请问一下C#版怎么去做,没找到相关接口
-
创建时间
20年1月7日
-
最后回复
20年1月21日
- 37
回复
- 807
浏览
- 2
用户
- 1
链接
sendmessageasync()连续发送消息正常,但间隔半分钟之后再发一条,会显示错误码SESSION_REQUIRED,用createconversationasync()创建的对话,对话链接中断频繁,文档上说明需要open session,请问一下C#版怎么去做,没找到相关接口
(Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)
2020-01-07 17:37:40.661 27913-28324/? I/Unity: auto heart beating ticked by timer.
(Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)
2020-01-07 17:37:40.674 27913-27952/? I/Unity: websocket=>{}
(Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)
2020-01-07 17:37:40.674 27913-27952/? I/Unity: DefaultWebSocketClient.OnMessage event add with 13 times
(Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)
2020-01-07 17:37:40.759 27913-28326/? I/Unity: websocket<={}
(Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)
2020-01-07 17:38:01.349 27913-27952/? I/Unity: --------------- SendMessageToLeanCloud user: development_13 chat_name: henry111 chat_type: 1 chat_msg: 大家好
(Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)
2020-01-07 17:38:01.351 27913-27952/? I/Unity: AVIMClient.OnMessageReceived event add with 3 times
(Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)
2020-01-07 17:38:01.352 27913-27952/? I/Unity: begin to attach singature.
(Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)
2020-01-07 17:38:01.355 27913-28352/? I/Unity: websocket=>{"cid":null,"attr":{"name":""},"m":["DEVG29"],"transient":false,"tempConv":false,"unique":true,"i":-65510,"cmd":"conv","appId":"vodmE5jFIXnvXu35iMmu4801-gzGzoHsz","op":"start","peerId":"development_13@boltrendgames.com"}
(Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)
2020-01-07 17:38:01.355 27913-28352/? I/Unity: DefaultWebSocketClient.OnMessage event add with 14 times
(Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)
2020-01-07 17:38:01.410 27913-28354/? I/Unity: websocket<={"reason":"SESSION_REQUIRED","code":4105,"cmd":"error","appId":"vodmE5jFIXnvXu35iMmu4801-gzGzoHsz","peerId":"development_13@boltrendgames.com","i":-65510,"service":2}
(Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)
2020-01-07 17:38:01.425 27913-28354/? I/Unity: DefaultWebSocketClient.OnMessage event remove with 13 times
(Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)
2020-01-07 17:38:01.475 27913-27952/? E/Unity: AVIMException: SESSION_REQUIRED
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in :0
at LeanCloud.Storage.Internal.InternalExtensions+<>c__DisplayClass7_0`1[TResult].b__0 (System.Threading.Tasks.Task t) [0x00033] in <179a75b7fa894ee0b895182963eead4d>:0
at System.Threading.Tasks.ContinuationResultTaskFromTask`1[TResult].InnerInvoke () [0x00024] in :0
at System.Threading.Tasks.Task.Execute () [0x00010] in :0
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in :0
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0003e] in :0
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.
发送消息代码如下:
var msg = new AVIMTypedMessage();
msg["userNo"] = "";
msg["userName"] = "";
msg["userIconID"] = "";
msg["messageType"] = "";
msg["timestamp"] = NowServerDateTime().ToLocalTime().ToString("s");
msg.TextContent = "";
var selfClient = await realtime.CreateClientAsync(userID);
var conversation = await selfClient.CreateConversationAsync(roomID);
await conversation.SendMessageAsync(msg).ContinueWith(task =>
{
if (task.Exception != null)
{
UnityEngine.Debug.Log("------------------- " + task.Exception.ToString());
}
else if (task.IsCompleted)
{
}
});