Unified Realtime/API framework for .NET platform and Unity.
MIT License
Bot releases are visible (Hide)
Published by github-actions[bot] over 2 years ago
Full Changelog: https://github.com/Cysharp/MagicOnion/compare/4.4.0...4.4.1
Published by github-actions[bot] over 2 years ago
We will no longer provide and support MagicOnion.Server.Authentication (Preview package).
If your applicaiton requires authentication mechanism, this can be achieved on top of the standard authentication mechanism in ASP.NET Core.
See: Authentication and authorization in gRPC for ASP.NET Core
Full Changelog: https://github.com/Cysharp/MagicOnion/compare/4.3.1...4.4.0
Published by github-actions[bot] over 3 years ago
Published by github-actions[bot] over 3 years ago
Use ChannelBase
(included in Grpc.Core.Api) for channel abstraction.
Remove overloads to receive IMagicOnionAwareGrpcChannel
, Channel
, GrpcChannel
from MagicOnionClient
and StreamingHubClient
.
MagicOnion now requires gRPC v1.27.0 (Grpc.Core.Api v2.27.0) or later.
You may need to remove following source codes from your Unity project.
Because GrpcChannel has a method named ForAddress, GrpcChannelx follows it.
Following APIs are marked as deprecated:
GrpcChannelx.FromAddress(Uri)
GrpcChannelx.FromTarget(GrpcChannelTarget)
Use GrpcChannelx.ForAddress
or GrpcChannelx.ForTarget
instead.
Published by github-actions[bot] over 3 years ago
Wraps gRPC channels and provides a mechanism to manage them with Unity's lifecycle.
This prevents your application and the Unity Editor from freezing by releasing channels and StreamingHub in one place.
The editor extension also provides the ability to display the communication status of channels.
NOTE: The data rate is calculated only for the message body of methods, and does not include Headers, Trailers, or Keep-alive pings.
MagicOnion.GrpcChannelx
classGrpcChannelx.FromTarget(GrpcChannelTarget)
methodGrpcChannelx.FromAddress(Uri)
methodMagicOnion.Unity.GrpcChannelProviderHost
classGrpcChannelProviderHost.Initialize(IGrpcChannelProvider)
methodMagicOnion.Unity.IGrpcChannelProvider
interfaceDefaultGrpcChannelProvider
classLoggingGrpcChannelProvider
classGrpcChannelx
in your Unity project.Before creating a channel in your application, you need to initialize the provider host to be managed.
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
public static void OnRuntimeInitialize()
{
// Initialize gRPC channel provider when the application is loaded.
GrpcChannelProviderHost.Initialize(new DefaultGrpcChannelProvider(new []
{
// 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),
}));
}
GrpcChannelProviderHost will be created as DontDestroyOnLoad and keeps existing while the application is running. DO NOT destory it.
GrpcChannelx.FromTarget
or GrpcChannelx.FromAddress
to create a channel.Use GrpcChannelx.FromTarget
or GrpcChannelx.FromAddress
to create a channel instead of new Channel(...)
.
var channel = GrpcChannelx.FromTarget(new GrpcChannelTarget("localhost", 12345, ChannelCredentials.Insecure));
// or
var channel = GrpcChannelx.FromAddress(new Uri("http://localhost:12345"));
Grpc.Core.Channel
.var channel = GrpcChannelx.FromAddress(new Uri("http://localhost:12345"));
var serviceClient = MagicOnionClient.Create<IGreeterService>(channel);
var hubClient = StreamingHubClient.ConnectAsync<IGreeterHub, IGreeterHubReceiver>(channel, this);
Published by github-actions[bot] over 3 years ago
Published by github-actions[bot] over 3 years ago
Published by github-actions[bot] over 3 years ago
MagicOnion.Client (4.1.x or later) is not compatible with MagicOnion.Server v4.0.x or ealier.
MagicOnion.Client 4.0.x or earlier + MagicOnion.Server v4.1 is still compatible.
Client 4.0.x | Client 4.1.x | |
---|---|---|
Server 4.0.x | ✓ | Not Compatible |
Server 4.1.x | ✓ | ✓ |
Added ConnectAsync
method to wait for StreamingHub connection establishment. ConnectAsync
will be able to catch errors while trying to connect.
For example, if the channel has not been established, or if there is an authentication error.
try
{
var client = await StreamingHubClient.ConnectAsync<Hub, HubReceiver>(channel, this);
// Do stuff...
}
catch (RpcException ex)
{
// An error occurred while connecting to the server.
}
NOTE:
StreamingHubClient.Connect
is marked as deprecated. UseConnectAsync
instead.
Published by github-actions[bot] almost 4 years ago
Published by github-actions[bot] almost 4 years ago
Published by github-actions[bot] almost 4 years ago
Published by github-actions[bot] almost 4 years ago
We moved the gRPC library used by MagicOnion from the C-core to the C# implementation.
MagicOnion server is built on ASP.NET Core and Kestrel for high performance in combination with .NET 5.0.
MagicOnion.Server
is now built on ASP.NET Core gRPC services.
MagicOnion.Client
for .NET Standard 2.1 is now depends on Grpc.Net.Client
.
MagicOnion.Hosting
and MagicOnion-standalone server are now droppedUse MagicOnion.Server
and ASP.NET Core instead of that.
In other words, MagicOnion server doesn't support non-.NET Core platform (e.g. .NET Framework, Unity, Mono ...).
The server/client monolithic package has been decoupled.
MagicOnion
: Meta package for MagicOnion.Server
and MagicOnion.Client
MagicOnion.Client
: MagicOnion client library for .NET Standard 2.0/2.1MagicOnion.Client.Unity
: MagicOnion client library for Unity 2018 or later (The codes are shared with MagicOnion.Client
)MagicOnion.Server
: MagicOnion server library for ASP.NET Core 3.1MagicOnion.Server.HttpGateway
: Swagger extension for MagicOnion.ServerMagicOnion.Server.Redis
: Redis extension for MagicOnion.ServerMagicOnion.Server.OpenTelemetry
: OpenTelemetry extension for MagicOnion.Server (experimental)MagicOnion.Server.Authentication
: Authentication extension for MagicOnion.Server (preview)MagicOnion.Shared
: Shared internal utilities for the client and server.IMagicOnionClientLogger
instead of Grpc.Core.Logging.ILogger
Grpc.Core.Logging.ILogger
API is part of C-core library.
DefaultGroupRepositoryFactory
If you are using MagicOnion.Redis, use UseRedisGroupRepository(Action<RedisGroupOptions> configure, bool registerAsDefault = false)
instead.
services.AddMagicOnion()
.UseRedisGroupRepository(options =>
{
options.ConnectionMultiplexer = StackExchange.Redis.ConnectionMultiplexer.Connect("localhost:6379");
});
// If you want to use Redis backplane by default, you can specify `registerAsDefault: true`.
services.AddMagicOnion()
.UseRedisGroupRepository(options => { ... }, registerAsDefault: true);
Published by github-actions[bot] almost 4 years ago
We moved the gRPC library used by MagicOnion from the C-core to the C# implementation.
MagicOnion server is built on ASP.NET Core and Kestrel for high performance in combination with .NET 5.0.
MagicOnion.Server
is now built on ASP.NET Core gRPC services.
MagicOnion.Client
for .NET Standard 2.1 is now depends on Grpc.Net.Client
.
MagicOnion.Hosting
and MagicOnion-standalone server are now droppedUse MagicOnion.Server
and ASP.NET Core instead of that.
In other words, MagicOnion server doesn't support non-.NET Core platform (e.g. .NET Framework, Unity, Mono ...).
The server/client monolithic package has been decoupled.
MagicOnion
: Meta package for MagicOnion.Server
and MagicOnion.Client
MagicOnion.Client
: MagicOnion client library for .NET Standard 2.0/2.1MagicOnion.Client.Unity
: MagicOnion client library for Unity 2018 or later (The codes are shared with MagicOnion.Client
)MagicOnion.Server
: MagicOnion server library for ASP.NET Core 3.1MagicOnion.Server.HttpGateway
: Swagger extension for MagicOnion.ServerMagicOnion.Server.Redis
: Redis extension for MagicOnion.ServerMagicOnion.Server.OpenTelemetry
: OpenTelemetry extension for MagicOnion.Server (experimental)MagicOnion.Server.Authentication
: Authentication extension for MagicOnion.Server (preview)MagicOnion.Shared
: Shared internal utilities for the client and server.IMagicOnionClientLogger
instead of Grpc.Core.Logging.ILogger
Grpc.Core.Logging.ILogger
API is part of C-core library.
DefaultGroupRepositoryFactory
If you are using MagicOnion.Redis, use UseRedisGroupRepository(Action<RedisGroupOptions> configure, bool registerAsDefault = false)
instead.
services.AddMagicOnion()
.UseRedisGroupRepository(options =>
{
options.ConnectionMultiplexer = StackExchange.Redis.ConnectionMultiplexer.Connect("localhost:6379");
});
// If you want to use Redis backplane by default, you can specify `registerAsDefault: true`.
services.AddMagicOnion()
.UseRedisGroupRepository(options => { ... }, registerAsDefault: true);
Published by github-actions[bot] over 4 years ago
Renewd MagicOnion.OpenTelemery package
Published by neuecc over 4 years ago
MagicOnion.Server.Authentication
package provides a simple authentication mechanism on MagicOnion. Currently, the package is marked as preview.
$ dotnet add package -v 3.0.10-preview MagicOnion.Server.Authentication
MagicOnion.Server.Authentication
provides two API surfaces.
AuthorizeAttribute
, AllowAnonymousAttribute
)To use the framework, 3rd-party developers can implement JWT-based authentication with minimal effort. The developers just implement below interfaces.
MagicOnion.Server.Authentication.Jwt.IJwtAuthenticationProvider
System.Security.Principal.IIdentity
Sample code: https://github.com/Cysharp/MagicOnion/tree/master/samples/JwtAuthentication
Published by neuecc over 4 years ago
⚠NOTE: If you installed the previous version in your project, delete existing MagicOnion package before upgrading.
MagicOnion.Abstractions
from MagicOnion
in Unity project.
MagicOnion.sln
).UnityDebugLogger
and ChannelExtensions
are removed at v3.0. But we did not intented to that.MagicOnion.Unity
directory.UnsafeDirectBlitResolver
does not exists in Unitymoc
uses ConsoleAppFramework https://github.com/Cysharp/ConsoleAppFramework/