Skip to content

Releases: Cysharp/MagicOnion

Ver.4.4.0

03 Feb 07:49
Compare
Choose a tag to compare

Breaking Changes

Remove MagicOnion.Server.Authentication in #483 #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

  • Add UnaryResult.FromResult(), UnaryResult.Nil in #463
  • Make default(UnaryResult) awaitable in #466
  • Target .NET 6 in #469 #470
  • Introduce GenerateIfDirectiveAttribute in #493

Improvements

  • Use RequestServices instead of a manually scoped ServiceProvider in #479
  • Clarify the message when it fails to negotiate with the server in #480
  • Pass attributes as metadata on binding gRPC method in #484

Other Changes

  • Add code highlight hint to sample code for Filter by @bamchoh in #443
  • feat: publish OpenTelemetry support to NuGet listed latest version. by @guitarrapc in #422
  • MagicOnion.Unity: Grpc.Net.Client in #446 #447
  • Symbols should not be cached across Compilation in #448
  • Fix typos in README by @hankovich in #450
  • Ignore PackageReference element if it does not have Include attribute in #454
  • Update smple code "await foreach" by @NepPure in #468
  • Ignore exception on disconnection by STREAM_RST in #475
  • HttpGateway breaks if service uses explicit interface implementation feature by @bearpro in #473
  • Ignore InvalidOperationException if the connection is completed in #478
  • Fix warnings in #477

New Contributors

Full Changelog: 4.3.1...4.4.0

Ver.4.3.1

31 May 06:50
Compare
Choose a tag to compare

Changes

Fixes

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

Ver.4.3.0

19 May 09:03
Compare
Choose a tag to compare

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.

Ver.4.2.0

02 Apr 06:18
Compare
Choose a tag to compare

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

Ver.4.1.2

10 Feb 05:48
Compare
Choose a tag to compare

Changes

Fixes

  • Write a marker that is the beginning of the stream. #411

Ver.4.1.1

03 Feb 06:50
dfae274
Compare
Choose a tag to compare

Changes

Fixes

  • Fix accessibility of MarshallingAsyncStreamReaderWriter #406

Ver.4.1.0

02 Feb 02:50
57ae44c
Compare
Choose a tag to compare

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

Ver.4.0.4

22 Dec 02:24
Compare
Choose a tag to compare

Changes

Fixes

  • Better exception message #390

Ver.4.0.3

14 Dec 10:10
5d8932a
Compare
Choose a tag to compare

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

Ver.4.0.2

18 Nov 07:20
28553e4
Compare
Choose a tag to compare

Changes

Fixes

  • Raised exception when using RedisGroupRepositoryFactory (#373, #375)