MagicOnion

Unified Realtime/API framework for .NET platform and Unity.

MIT License

Stars
3.7K
Committers
44

Bot releases are visible (Hide)

MagicOnion - Ver.4.4.1

Published by github-actions[bot] over 2 years ago

What's Changed

Other Changes

New Contributors

Full Changelog: https://github.com/Cysharp/MagicOnion/compare/4.4.0...4.4.1

MagicOnion - Ver.4.4.0

Published by github-actions[bot] over 2 years ago

Breaking Changes

Remove MagicOnion.Server.Authentication in https://github.com/Cysharp/MagicOnion/pull/483 https://github.com/Cysharp/MagicOnion/pull/484

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

Features

Improvements

Other Changes

New Contributors

Full Changelog: https://github.com/Cysharp/MagicOnion/compare/4.3.1...4.4.0

MagicOnion - Ver.4.3.1

Published by github-actions[bot] over 3 years ago

Changes

Fixes

  • SynchronizationContext should not be restored when the stream is completed in WebGL #439
  • Clarify the exception message. #437
MagicOnion - Ver.4.3.0

Published by github-actions[bot] over 3 years ago

Changes

Breaking changes

[Client] Use ChannelBase for channel abstraction #433

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.

  • MagicOnionClient.CCore.cs
  • MagicOnionClient.NetStandard.cs
  • StreamingHubClient.CCore.cs
  • StreamingHubClient.NetStandard.cs

API changes and deprecation

[Client.Unity] Make the method names of GrpcChannelx like the API of GrpcChannel #434

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.

MagicOnion - Ver.4.2.0

Published by github-actions[bot] over 3 years ago

New Features

Unity: Introduce gRPC channel management integration #414

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.

Screen08

NOTE: The data rate is calculated only for the message body of methods, and does not include Headers, Trailers, or Keep-alive pings.

New APIs

MagicOnion.GrpcChannelx class

  • GrpcChannelx.FromTarget(GrpcChannelTarget) method
  • GrpcChannelx.FromAddress(Uri) method

MagicOnion.Unity.GrpcChannelProviderHost class

  • GrpcChannelProviderHost.Initialize(IGrpcChannelProvider) method

MagicOnion.Unity.IGrpcChannelProvider interface

  • DefaultGrpcChannelProvider class
  • LoggingGrpcChannelProvider class

Usages

1. Prepare to use GrpcChannelx 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.

image

2. Use 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"));

3. Use the channel instead of 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);

Extensions for Unity Editor (Editor Window & Inspector)

image

Improvements

  • Improve StreamingHub's grouping writer #416

Fixes

  • Fix handling of Generics for StreamingHub code generation #419
MagicOnion - Ver.4.1.2

Published by github-actions[bot] over 3 years ago

Changes

Fixes

  • Write a marker that is the beginning of the stream. #411
MagicOnion - Ver.4.1.1

Published by github-actions[bot] over 3 years ago

Changes

Fixes

  • Fix accessibility of MarshallingAsyncStreamReaderWriter #406
MagicOnion - Ver.4.1.0

Published by github-actions[bot] over 3 years ago

Changes

Breaking changes

MagicOnion.Client (StreamingHubClient) versioning

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

Introduce StreamingHubClient.ConnectAsync

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. Use ConnectAsync instead.

Improvements

  • Update NuGet packages #402
  • Bump minimum unity version to 2018.4.13f1+ #401
  • Add package.json to MagicOnion.Client.Unity #400
  • Better StreamingHubCilent Errors #393

Fixes

  • Ignore OperationCanceledException thrown when a client disconnects. #403
  • Fix asmdef missing MessagePack.Annotations #400
MagicOnion - Ver.4.0.4

Published by github-actions[bot] almost 4 years ago

Changes

Fixes

  • Better exception message #390
MagicOnion - Ver.4.0.3

Published by github-actions[bot] almost 4 years ago

Changes

Fixes

  • A client sdk getting falsely picked up as a server service through reflection. #387
  • Exclude well-known assemblies from automatic discovery of services. #389
  • Ignore IOException when the stream is disconnected by the client. #376
MagicOnion - Ver.4.0.2

Published by github-actions[bot] almost 4 years ago

Changes

Fixes

  • Raised exception when using RedisGroupRepositoryFactory (#373, #375)
MagicOnion - Ver.4.0.1

Published by github-actions[bot] almost 4 years ago

The Beginning of the C-Core removal journey

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.
    • gRPC C-core dependency has been removed completely in the server.
  • MagicOnion.Client for .NET Standard 2.1 is now depends on Grpc.Net.Client.
    • gRPC C-core is no longer needed on .NET Standard 2.1 (.NET Core 3.x, Xamarin, ...) platform.
    • The client library still supports .NET Standard 2.0 platforms (e.g. .NET Framework 4.6.1, .NET Core 2.x and Unity).

Improvements

  • Adopt .NET 5.0 (#366)
  • Enable nullable reference type annotations (MagicOnion.Server)

Breaking changes

MagicOnion.Hosting and MagicOnion-standalone server are now dropped

Use 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 ...).

Reorganize project structure

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.1
  • MagicOnion.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.1
  • MagicOnion.Server.HttpGateway: Swagger extension for MagicOnion.Server
  • MagicOnion.Server.Redis: Redis extension for MagicOnion.Server
  • MagicOnion.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.

Use IMagicOnionClientLogger instead of Grpc.Core.Logging.ILogger

Grpc.Core.Logging.ILogger API is part of C-core library.

Remove 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);

Fixes from 4.0.0

  • Move namespace Microsoft.AspNetCore.Routing -> Microsoft.AspNetCore.Builder (#370)
MagicOnion - Ver.4.0.0

Published by github-actions[bot] almost 4 years ago

The Beginning of the C-Core removal journey

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.
    • gRPC C-core dependency has been removed completely in the server.
  • MagicOnion.Client for .NET Standard 2.1 is now depends on Grpc.Net.Client.
    • gRPC C-core is no longer needed on .NET Standard 2.1 (.NET Core 3.x, Xamarin, ...) platform.

Improvements

  • Adopt .NET 5.0 (#366)
  • Enable nullable reference type annotations (MagicOnion.Server)

Breaking changes

MagicOnion.Hosting and MagicOnion-standalone server are now dropped

Use 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 ...).

Reorganize project structure

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.1
  • MagicOnion.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.1
  • MagicOnion.Server.HttpGateway: Swagger extension for MagicOnion.Server
  • MagicOnion.Server.Redis: Redis extension for MagicOnion.Server
  • MagicOnion.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.

Use IMagicOnionClientLogger instead of Grpc.Core.Logging.ILogger

Grpc.Core.Logging.ILogger API is part of C-core library.

Remove 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);
MagicOnion - Ver.3.0.12

Published by github-actions[bot] over 4 years ago

Renewd MagicOnion.OpenTelemery package

MagicOnion -

Published by neuecc over 4 years ago

Changes

Add RedisGroupOptions #287
Fix a critical memory out-of-bounds accessing bug of UnsafeDirectBlitResolver #286
Update roslyn version of code generator

Fixes

Impemenets RedisGroup.GetMemberCountAsync

MagicOnion - 3.0.10

Published by neuecc over 4 years ago

Changes

Improvements and fixes

  • #279 Bump MessagePack from 2.1.80 to 2.1.90

New features

#274 MagicOnion.Server.Authentication (Preview)

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.

  • Fundamental attributes (e.g. AuthorizeAttribute, AllowAnonymousAttribute)
  • JWT-based authentication implementation framework

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
  • Application-specific JWT payload

Sample code: https://github.com/Cysharp/MagicOnion/tree/master/samples/JwtAuthentication

MagicOnion - 3.0.9

Published by neuecc over 4 years ago

Changes

Improvements and fixes

#269 Add NuGet package icon

#254 Add AssemblyDefinition for Unity package and organize MagicOnion, MagicOnion.Abstractions

⚠NOTE: If you installed the previous version in your project, delete existing MagicOnion package before upgrading.

  • Separate MagicOnion.Abstractions from MagicOnion in Unity project.
    • The soruce code structures are same as solution/projects for .NET (MagicOnion.sln).
  • Restore and separate MagicOnion extensions for Unity.
    • UnityDebugLogger and ChannelExtensions are removed at v3.0. But we did not intented to that.
    • Now, the classes are placed into MagicOnion.Unity directory.

#258 Bump MessagePack from 2.0.323 to 2.1.80

MagicOnion -

Published by neuecc almost 5 years ago

  • Fixed does not work SwaggerMiddleware on .NET Core 3.0, thanks @ktanakaj
  • Fixed does not work broadcast by RedisGroup
  • Fixed UnsafeDirectBlitResolver does not exists in Unity
  • Improved, moc uses ConsoleAppFramework https://github.com/Cysharp/ConsoleAppFramework/
MagicOnion -

Published by neuecc almost 5 years ago

abandoned.

MagicOnion -

Published by neuecc almost 5 years ago

This release only affects MSBuild.Tasks.
fixed can not use UnuseUnityAttr attribute.