diff --git a/.github/workflows/build-debug.yml b/.github/workflows/build-debug.yml index 70c86f3c5..728faaea3 100644 --- a/.github/workflows/build-debug.yml +++ b/.github/workflows/build-debug.yml @@ -10,7 +10,6 @@ on: - '**.md' - .github/** - docs/** - - samples/** pull_request: branches: - main @@ -18,7 +17,6 @@ on: - '**.md' - .github/** - docs/** - - samples/** env: BUILD_CONFIG: Debug diff --git a/README.md b/README.md index 6369159ab..d40bd5c78 100644 --- a/README.md +++ b/README.md @@ -1066,12 +1066,12 @@ Before creating a channel in your application, you need to initialize the provid public static void OnRuntimeInitialize() { // Initialize gRPC channel provider when the application is loaded. - GrpcChannelProviderHost.Initialize(new DefaultGrpcChannelProvider(new [] + GrpcChannelProviderHost.Initialize(new DefaultGrpcChannelProvider(() => new GrpcChannelOptions() { - // send keepalive ping every 5 second, default is 2 hours - new ChannelOption("grpc.keepalive_time_ms", 5000), - // keepalive ping time out after 5 seconds, default is 20 seconds - new ChannelOption("grpc.keepalive_timeout_ms", 5 * 1000), + HttpHandler = new YetAnotherHttpHandler() + { + Http2Only = true, + }, })); } ``` diff --git a/samples/ChatApp/ChatApp.Shared/ChatApp.Shared.csproj b/samples/ChatApp/ChatApp.Shared/ChatApp.Shared.csproj index 6ec29391a..306985ff3 100644 --- a/samples/ChatApp/ChatApp.Shared/ChatApp.Shared.csproj +++ b/samples/ChatApp/ChatApp.Shared/ChatApp.Shared.csproj @@ -4,12 +4,6 @@ netstandard2.0 - - - - - - diff --git a/samples/ChatApp/ChatApp.Shared/Directory.Build.props b/samples/ChatApp/ChatApp.Shared/Directory.Build.props index 26047f8f5..5f2b4b91c 100644 --- a/samples/ChatApp/ChatApp.Shared/Directory.Build.props +++ b/samples/ChatApp/ChatApp.Shared/Directory.Build.props @@ -1,14 +1,16 @@ - - + - - - + Override the output path of build artifacts. + This is necessary to change the path to one with a dot(.) prefix to hide generated items from Unity. + --> + + + $(MSBuildThisFileDirectory).artifacts + + + .artifacts\obj\ + .artifacts\bin\ diff --git a/samples/ChatApp/ChatApp.Shared/Directory.Build.targets b/samples/ChatApp/ChatApp.Shared/Directory.Build.targets new file mode 100644 index 000000000..44515bfd9 --- /dev/null +++ b/samples/ChatApp/ChatApp.Shared/Directory.Build.targets @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/samples/ChatApp/ChatApp.Shared/Directory.Build.targets.meta b/samples/ChatApp/ChatApp.Shared/Directory.Build.targets.meta new file mode 100644 index 000000000..4c95937f6 --- /dev/null +++ b/samples/ChatApp/ChatApp.Shared/Directory.Build.targets.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: bab152c83c191c643a7056bc184c530b +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/src/MagicOnion.Client.Unity/Assets/Scripts/MagicOnion/MagicOnion.Unity/DefaultGrpcChannelProvider.cs b/src/MagicOnion.Client.Unity/Assets/Scripts/MagicOnion/MagicOnion.Unity/DefaultGrpcChannelProvider.cs index 525c31905..004226bbe 100644 --- a/src/MagicOnion.Client.Unity/Assets/Scripts/MagicOnion/MagicOnion.Unity/DefaultGrpcChannelProvider.cs +++ b/src/MagicOnion.Client.Unity/Assets/Scripts/MagicOnion/MagicOnion.Unity/DefaultGrpcChannelProvider.cs @@ -23,7 +23,8 @@ public DefaultGrpcChannelProvider(GrpcCCoreChannelOptions channelOptions) : base public class DefaultGrpcChannelProvider : GrpcNetClientGrpcChannelProvider { public DefaultGrpcChannelProvider() : base() {} - public DefaultGrpcChannelProvider(GrpcChannelOptions channelOptions) : base(channelOptions) {} + [Obsolete("Use constructor with a GrpcChannelOptions factory overload instead. If you pass a GrpcChannelOptions directly, HttpClient/HttpHandler may be reused unintentionally.")] + public DefaultGrpcChannelProvider(GrpcChannelOptions channelOptions) : base(channelOptions) { } public DefaultGrpcChannelProvider(Func channelOptionsFactory) : base(channelOptionsFactory) {} } #endif diff --git a/src/MagicOnion.Client.Unity/Assets/Scripts/MagicOnion/MagicOnion.Unity/GrpcNetClientGrpcChannelProvider.cs b/src/MagicOnion.Client.Unity/Assets/Scripts/MagicOnion/MagicOnion.Unity/GrpcNetClientGrpcChannelProvider.cs index b5a1a47db..d491f41a9 100644 --- a/src/MagicOnion.Client.Unity/Assets/Scripts/MagicOnion/MagicOnion.Unity/GrpcNetClientGrpcChannelProvider.cs +++ b/src/MagicOnion.Client.Unity/Assets/Scripts/MagicOnion/MagicOnion.Unity/GrpcNetClientGrpcChannelProvider.cs @@ -13,10 +13,11 @@ public class GrpcNetClientGrpcChannelProvider : GrpcChannelProviderBase { readonly Func defaultChannelOptionsFactory; public GrpcNetClientGrpcChannelProvider() - : this(new GrpcChannelOptions()) + : this(() => new GrpcChannelOptions()) { } + [Obsolete("Use constructor with a GrpcChannelOptions factory overload instead. If you pass a GrpcChannelOptions directly, HttpClient/HttpHandler may be reused unintentionally.")] public GrpcNetClientGrpcChannelProvider(GrpcChannelOptions options) : this(() => options) {