Cysharp / MagicOnion

Unified Realtime/API framework for .NET platform and Unity.
MIT License
3.89k stars 433 forks source link

MagicOnion does not work properly in Unity #806

Open 526677804 opened 4 months ago

526677804 commented 4 months ago

Basic info:

  1. Unity:2022.3.30f1
  2. MagicOnion:6.1.3
  3. YetAnotherHttpHandler:1.3.1

Case:

  1. Server
  2. Client (non-Unity)
  3. Client (Unity)

Refer to the document example, one server, two clients, 2 calls 1 normal, 3 calls 1 error

The following is the ‘3. Client (Unity)’ code, configuration and error: 1.code image

2.config image

3.error

IOException: client error (SendRequest) Cysharp.Net.Http.ResponseContext.CompleteAsFailed (System.String errorMessage) (at Assets/Packages/com.cysharp.yetanotherhttphandler/ResponseContext.cs:125) --- End of stack trace from previous location where exception was thrown --- Cysharp.Net.Http.ResponseContext.GetResponseAsync () (at Assets/Packages/com.cysharp.yetanotherhttphandler/ResponseContext.cs:154) Rethrow as HttpRequestException: client error (SendRequest) Cysharp.Net.Http.ResponseContext.GetResponseAsync () (at Assets/Packages/com.cysharp.yetanotherhttphandler/ResponseContext.cs:158) Grpc.Net.Client.Internal.GrpcCall2[TRequest,TResponse].RunCall (System.Net.Http.HttpRequestMessage request, System.Nullable1[T] timeout) (at <c521f2934b38415a9aef98ca65fec1a0>:0) Rethrow as RpcException: Status(StatusCode="Unavailable", Detail="Error starting gRPC call. HttpRequestException: client error (SendRequest) IOException: client error (SendRequest)", DebugException="System.Net.Http.HttpRequestException: client error (SendRequest)") MagicOnion.Client.ResponseContextRaw2[T,TRaw].FromRawResponseToResponseAsync () (at Assets/Packages/com.cysharp.magiconion/MagicOnion.Client/ResponseContext.cs:79) MagicOnion.UnaryResult1[TResponse].UnwrapResponse () (at Assets/Packages/com.cysharp.magiconion/MagicOnion.Abstractions/UnaryResult.cs:261) TestGRPC.OnClientGRPCButtonClick () (at Assets/TestGRPC.cs:58) System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state) (at <467a840a914a47078e4ae9b0b1e8779e>:0) UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () (at <0652bf0e14024522b5c92574ad0ef550>:0) UnityEngine.UnitySynchronizationContext.Exec () (at <0652bf0e14024522b5c92574ad0ef550>:0) UnityEngine.UnitySynchronizationContext.ExecuteTasks () (at <0652bf0e14024522b5c92574ad0ef550>:0)

mayuki commented 4 months ago

A more detailed error may be available by using YetAnotherHttpHandler 1.4.1. Could you give me that error if possible?