NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
NuGet
NuGet, #2010 most downloaded on NuGet
Unified Realtime/API framework for .NET platform and Unity. This package is meta package that includes MagicOnion.Server and MagicOnion.Client.
Latest stable
7.11.0
Last release 2 months ago
14 Sep 2026
Release timing varies
gaps range from 2 weeks to 4 months
Nearly every release is documented
notes for 56 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
10 years old
101 releases · first in 2016
Drag across the ruler to compare, or tap a release to open it.
The UnsafeDirectBlit formatters have been deprecated. They are considered unsafe because they rely on the memory layout of types and make it easy for…
<!-- Release notes generated using configuration in .github/release.yml at 7.11.0 -->
The UnsafeDirectBlit formatters have been deprecated. They are considered unsafe because they rely on the memory layout of types and make it easy for untrusted serialized data to cause memory corruption during deserialization.
UnsafeDirectBlit will be removed in the next major version. You may copy and use the existing code, but it will no longer be supported or maintained by the project.
The limit is intended to protect the server by placing an upper bound on the amount of queued work. If the limit is reached for a connection, the client is disconnected.
A full response queue is expected to be a rare condition, and the default value should be sufficient in most cases. However, users can increase or decrease the limit as needed.
Full Changelog: https://github.com/Cysharp/MagicOnion/compare/7.10.2...7.11.0
Your coding agent can read these notes before it upgrades. Set up the MCP server →
Bump MessagePack to 3.1.7 to address vulnerability. by @jeff-at-trimble in https://github.com/Cysharp/MagicOnion/pull/1076
<!-- Release notes generated using configuration in .github/release.yml at 7.10.2 -->
Full Changelog: https://github.com/Cysharp/MagicOnion/compare/7.10.1...7.10.2
<!-- Release notes generated using configuration in .github/release.yml at 7.10.1 -->
<!-- Release notes generated using configuration in .github/release.yml at 7.10.1 -->
no or autobuild by @guitarrapc in https://github.com/Cysharp/MagicOnion/pull/1042Full Changelog: https://github.com/Cysharp/MagicOnion/compare/7.10.0...7.10.1
<!-- Release notes generated using configuration in .github/release.yml at 7.10.0 -->
<!-- Release notes generated using configuration in .github/release.yml at 7.10.0 -->
Map method call failures with Grpc.AspNetCore.Server 2.76.0 and later. by @mayuki in https://github.com/Cysharp/MagicOnion/pull/1037Full Changelog: https://github.com/Cysharp/MagicOnion/compare/7.0.9...7.10.0
<!-- Release notes generated using configuration in .github/release.yml at 7.0.9 -->
<!-- Release notes generated using configuration in .github/release.yml at 7.0.9 -->
Full Changelog: https://github.com/Cysharp/MagicOnion/compare/7.0.8...7.0.9
<!-- Release notes generated using configuration in .github/release.yml at 7.0.8 -->
<!-- Release notes generated using configuration in .github/release.yml at 7.0.8 -->
Full Changelog: https://github.com/Cysharp/MagicOnion/compare/7.0.7...7.0.8
<!-- Release notes generated using configuration in .github/release.yml at 7.0.7 -->
<!-- Release notes generated using configuration in .github/release.yml at 7.0.7 -->
IncludeMagicOnionXmlComments by @arika0093 in https://github.com/Cysharp/MagicOnion/pull/978Full Changelog: https://github.com/Cysharp/MagicOnion/compare/7.0.6...7.0.7
<!-- Release notes generated using configuration in .github/release.yml at 7.0.6 -->
<!-- Release notes generated using configuration in .github/release.yml at 7.0.6 -->
Sharded Pub/Sub can now be used by specifying RedisChannelFactory.Sharded in the ChannelFactory property of RedisGroupOptions, as shown in the code below.
services.Configure<RedisGroupOptions>(options =>
{
options.ChannelFactory = RedisChannelFactory.Sharded;
});
Full Changelog: https://github.com/Cysharp/MagicOnion/compare/7.0.5...7.0.6
<!-- Release notes generated using configuration in .github/release.yml at 7.0.5 -->
<!-- Release notes generated using configuration in .github/release.yml at 7.0.5 -->
Full Changelog: https://github.com/Cysharp/MagicOnion/compare/7.0.4...7.0.5
<!-- Release notes generated using configuration in .github/release.yml at 7.0.4 -->
<!-- Release notes generated using configuration in .github/release.yml at 7.0.4 -->
Full Changelog: https://github.com/Cysharp/MagicOnion/compare/7.0.3...7.0.4
<!-- Release notes generated using configuration in .github/release.yml at 7.0.3 -->
<!-- Release notes generated using configuration in .github/release.yml at 7.0.3 -->
Full Changelog: https://github.com/Cysharp/MagicOnion/compare/7.0.2...7.0.3
<!-- Release notes generated using configuration in .github/release.yml at 7.0.2 -->
<!-- Release notes generated using configuration in .github/release.yml at 7.0.2 -->
Full Changelog: https://github.com/Cysharp/MagicOnion/compare/7.0.1...7.0.2
<!-- Release notes generated using configuration in .github/release.yml at 7.0.1 -->
<!-- Release notes generated using configuration in .github/release.yml at 7.0.1 -->
Full Changelog: https://github.com/Cysharp/MagicOnion/compare/7.0.0...7.0.1
<!-- Release notes generated using configuration in .github/release.yml at 7.0.0 -->
<!-- Release notes generated using configuration in .github/release.yml at 7.0.0 -->
Until now, the only MagicOnion documentation available was the README file, but we have now launched a new documentation site.
https://cysharp.github.io/MagicOnion/
The new site has been updated and reorganized from the previous README file, making it easier to read. This site has only just been launched, so we plan to continue updating and improving it.
In addition, the Japanese version of the documentation is also available.
void return value support for StreamingHub methodsStreamingHub method now supports void return value. This can be used for Fire-and-Forget pattern that does not require a return value from the server.
Added a mechanism to wait for the receiver's method call in StreamingHub and receive the processing result on the server. For more information, see Client Results.
Added a built-in heartbeat feature to StreamingHub. For more information, see Heartbeat.
MessagePack has been upgraded to v3. This eliminates the need for using MessagePack Generator (mpc) in Unity and AOT environments. For more information, see the MessagePack-CSharp release.
Backends of StreamingHub groups have been refreshed to be based on Multicaster, allowing for more flexible group operations. This has resulted in changes to the group-related APIs.
All, Single, Only, Except methodsBroadcast methods in StreamingHubBase and CreateBroadcaster methods in GroupFor more information, see Groups and Application-managed groups. For migration from v6, see the migration guide.
MagicOnion.Server.HttpGateway, which was used for Swagger support, has been removed. Instead, MagicOnion.Server.JsonTranscoding has been introduced, which encodes/decodes requests/responses in JSON. and its Swagger support has been added. For more information, see JSON Transcoding.
AddLogging and AddGrpc implicitlyThe WaitForDisconnectAsync method has been added to the StreamingHub client. This method waits for disconnection as before with WaitForDisconnect, but now returns the reason for disconnection. This allows you to get disconnection reasons such as timeouts due to heartbeats. For more information, see Disconnection.
We no longer support .NET 7 as its runtime support has ended. Please use .NET 8 or later.
StreamingHubContext is now reused, so caching StreamingHubContext outside of Hub method calls may result in unexpected behavior. The context is only valid during the call.
We have reworked the mechanism for registering MagicOnion methods as gRPC methods on the server. This changes the timing of registering MagicOnion Unary/StreamingHub services from application build to request pipeline/route construction.
AddMagicOnion was used to register Unary/StreamingHub services, but now you need to change it to register with MapMagicOnionService.
We have removed support for the C-core gRPC library in Unity. Please use grpc-dotnet and YetAnotherHttpHandler instead. For more information, see Using with Unity.
In previous versions, when a client called a method after being disconnected from StreamingHub, an ObjectDisposedException was thrown. Now, an RpcException is thrown. ObjectDisposedException is only thrown when it is disposed like a general class.
Please refer to the documentation for migration instructions from v6. https://cysharp.github.io/MagicOnion/release-notes/7.0#migration-guide
<details> <summary>Changes between 6.1.3 to 7.0.0</summary>
</details>
Full Changelog: https://github.com/Cysharp/MagicOnion/compare/6.1.3...7.0.0
void return value support for StreamingHub methodsStreamingHub method now supports void return value. This can be used for Fire-and-Forget pattern that does not require a return value from the server.
Added a mechanism to wait for the receiver's method call in StreamingHub and receive the processing result on the server. For more information, see Client Results.
Added a built-in heartbeat feature to StreamingHub. For more information, see Heartbeat.
MessagePack has been upgraded to v3. This eliminates the need for using MessagePack Generator (mpc) in Unity and AOT environments. For more information, see the MessagePack-CSharp release.
Backends of StreamingHub groups have been refreshed to be based on Multicaster, allowing for more flexible group operations. This has resulted in changes to the group-related APIs.
All, Single, Only, Except methodsBroadcast methods in StreamingHubBase and CreateBroadcaster methods in GroupFor more information, see Groups and Application-managed groups. For migration from v6, see the migration guide.
MagicOnion.Server.HttpGateway, which was used for Swagger support, has been removed. Instead, MagicOnion.Server.JsonTranscoding has been introduced, which encodes/decodes requests/responses in JSON. and its Swagger support has been added. For more information, see JSON Transcoding.
AddLogging and AddGrpc implicitlyThe WaitForDisconnectAsync method has been added to the StreamingHub client. This method waits for disconnection as before with WaitForDisconnect, but now returns the reason for disconnection. This allows you to get disconnection reasons such as timeouts due to heartbeats. For more information, see Disconnection.
We no longer support .NET 7 as its runtime support has ended. Please use .NET 8 or later.
StreamingHubContext is now reused, so caching StreamingHubContext outside of Hub method calls may result in unexpected behavior. The context is only valid during the call.
We have reworked the mechanism for registering MagicOnion methods as gRPC methods on the server. This changes the timing of registering MagicOnion Unary/StreamingHub services from application build to request pipeline/route construction.
AddMagicOnion was used to register Unary/StreamingHub services, but now you need to change it to register with MapMagicOnionService.
We have removed support for the C-core gRPC library in Unity. Please use grpc-dotnet and YetAnotherHttpHandler instead. For more information, see Using with Unity.
In previous versions, when a client called a method after being disconnected from StreamingHub, an ObjectDisposedException was thrown. Now, an RpcException is thrown. ObjectDisposedException is only thrown when it is disposed like a general class.
In contrast to general .NET applications, upgrading Unity clients requires installing MagicOnion in an empty Unity project and copying it to the target project.
This is because you cannot install NuGet packages in Unity projects that already have MagicOnion and MessagePack installed via the Unity package manager, and even if you simply remove those libraries, you will get build errors and the packages will remain in place.
"com.cysharp.magiconion": "https://github.com/Cysharp/MagicOnion.git?path=/src/MagicOnion.Client.Unity/Assets/Scripts/MagicOnion#{Version}",
The above line should be rewritten as follows. Replace {Version} with the version you want to install.
"com.cysharp.magiconion.client.unity": "https://github.com/Cysharp/MagicOnion.git?path=/src/MagicOnion.Client.Unity/Assets/Scripts/MagicOnion.Client.Unity#{Version}",
StreamingHub group functionality has been significantly changed in StreamingHub v7, so there is no API compatibility at the code level. Therefore, when migrating from v6 to v7, you need to change the usage to v7 or use the compatibility API shim.
If you are using StreamingHub and InMemoryStorage, you can use the following compatibility API shim when migrating to v7 to enable a step-by-step migration. However, this compatibility shim does not include the features of InMemoryStorage in groups, so you will need to make separate arrangements if you are using those features.
using Cysharp.Runtime.Multicast;
namespace MagicOnion.Server.Hubs;
public abstract class StreamingHubBaseCompat<THub, TReceiver> : StreamingHubBase<THub, TReceiver>
where THub : IStreamingHub<THub, TReceiver>
{
protected TReceiver Broadcast(IGroup group) => ((GroupCompat<TReceiver>)group).Inner.All;
protected TReceiver BroadcastExceptSelf(IGroup group) => ((GroupCompat<TReceiver>)group).Inner.Except(ConnectionId);
protected TReceiver BroadcastExcept(IGroup group, Guid except) => ((GroupCompat<TReceiver>)group).Inner.Except(except);
protected TReceiver BroadcastExcept(IGroup group, IReadOnlyList<Guid> excepts) => ((GroupCompat<TReceiver>)group).Inner.Except(excepts);
protected TReceiver BroadcastToSelf(IGroup group) => ((GroupCompat<TReceiver>)group).Inner.Single(ConnectionId);
protected TReceiver BroadcastTo(IGroup group, Guid toConnectionId) => ((GroupCompat<TReceiver>)group).Inner.Single(toConnectionId);
protected TReceiver BroadcastTo(IGroup group, IReadOnlyList<Guid> toConnectionIds) => ((GroupCompat<TReceiver>)group).Inner.Only(toConnectionIds);
protected new HubGroupRepository Group { get; }
protected StreamingHubBaseCompat()
{
Group = new HubGroupRepositoryCompat<TReceiver>(base.Group);
}
class HubGroupRepositoryCompat<T> : HubGroupRepository
{
readonly HubGroupRepository<T> groupRepo;
public HubGroupRepositoryCompat(HubGroupRepository<T> groupRepo)
{
this.groupRepo = groupRepo;
}
public override async ValueTask<IGroup> AddAsync(string name)
=> new GroupCompat<T>(await groupRepo.AddAsync(name));
}
class GroupCompat<T> : IGroup
{
public IGroup<T> Inner { get; }
public GroupCompat(IGroup<T> inner)
{
this.Inner = inner;
}
public ValueTask RemoveAsync(ServiceContext serviceContext)
=> this.Inner.RemoveAsync(serviceContext);
public T1 CreateBroadcaster<T1>() => (T1)(object)Inner.All!;
public T1 CreateBroadcasterTo<T1>(Guid toConnectionId) => (T1)(object)Inner.Single(toConnectionId)!;
public T1 CreateBroadcasterTo<T1>(IReadOnlyList<Guid> toConnectionIds) => (T1)(object)Inner.Only(toConnectionIds)!;
public T1 CreateBroadcasterExcept<T1>(Guid toConnectionId) => (T1)(object)Inner.Except(toConnectionId)!;
public T1 CreateBroadcasterExcept<T1>(IReadOnlyList<Guid> toConnectionIds) => (T1)(object)Inner.Except(toConnectionIds)!;
}
}
public interface IGroup
{
ValueTask RemoveAsync(ServiceContext serviceContext);
T CreateBroadcaster<T>();
T CreateBroadcasterTo<T>(Guid toConnectionId);
T CreateBroadcasterTo<T>(IReadOnlyList<Guid> toConnectionIds);
T CreateBroadcasterExcept<T>(Guid toConnectionId);
T CreateBroadcasterExcept<T>(IReadOnlyList<Guid> toConnectionIds);
}
public abstract class HubGroupRepository
{
public abstract ValueTask<IGroup> AddAsync(string name);
}
void をサポートStreamingHub メソッドの戻り値として void をサポートしました。これはサーバーからの戻り値を必要としない Fire-and-Forget パターンで使用できます。
StreamingHub でレシーバーのメソッド呼び出しを待機し、クライアントでの処理結果をサーバーで受け取れる仕組みを追加しました。詳細については クライアント結果 を参照してください。
StreamingHub で組み込みのハートビート機能を追加しました。詳細については ハートビート を参照してください。
MessagePack が v3 にアップグレードされました。これにより Unity や AOT 環境での MessagePack Generator (mpc) の使用が不要になります。詳しくは MessagePack-CSharp のリリース を参照してください。
StreamingHub のグループのバックエンドが Multicaster ベースに刷新され、より柔軟なグループ操作が可能となりました。これに伴いグループに関する API が変更となりました。
All, Single, Only, Except のメソッドの追加Broadcast 系メソッド および Group の CreateBroadcaster 系のメソッドの削除詳しくは グループ および アプリケーション管理のグループ を参照してください。また v6 からの移行に関しては 移行ガイド も参照してください。
Swagger サポートのための MagicOnion.Server.HttpGateway は削除されました。代わりに MagicOnion.Server.JsonTranscoding が導入され、JSON でのリクエスト/レスポンスのエンコード/デコードを行う MagicOnion.Server.JsonTranscoding とその Swagger サポートが追加されました。詳しくは JSON トランスコーディング を参照してください。
AddLogging と AddGrpc を暗黙的に呼び出すようにしましたStreamingHub クライアントに WaitForDisconnectAsync メソッドが追加されました。このメソッドは以前の WaitForDisconnect と同様に切断を待機しますが、切断時に理由を含めて返すようになりました。これによりハートビートによるタイムアウトであるといった切断理由を取得できるようになりました。詳しくは 切断 を参照してください。
.NET 7 はランタイムのサポートが終了したことを受けサポートされなくなりました。.NET 8 以上を使用してください。
StreamingHubContext は再利用されるようになったため、Hub メソッドの呼び出しの外で StreamingHubContext をキャッシュすると予期せぬ挙動となる可能性があります。コンテキストは呼び出し中にのみ有効です。
サーバーに MagicOnion のメソッドを gRPC メソッドとして登録する仕組みを再設計しました。これにより MagicOnion の Unary/SteramingHub サービスを登録するタイミングがアプリケーションのビルドではなく、リクエストパイプライン/ルート構築時に変更となりました。
以前は AddMagicOnion で登録していた Unary/StreamingHub サービスは MapMagicOnionService で登録するよう変更する必要があります
Unity での C-core gRPC ライブラリーのサポートを削除しました。代わりに grpc-dotnet と YetAnotherHttpHandler を使用してください。詳しくは Unity での利用 を参照してください。
以前のバージョンでは StreamingHub から切断された後、クライアントでメソッド呼び出しを行うと ObjectDisposedException がスローされていましたが、 RpcException がスローされるようになりました。一般的なクラスと同様に Dispose されたときのみ ObjectDisposedException がスローされます。
一般的な .NET アプリケーションと異なり、Unity クライアントのアップグレードでは空の Unity プロジェクトで MagicOnion をインストールしてコピーする必要があります。
これは Unity プロジェクトにすでに Unity パッケージマネージャー経由で MagicOnion や MessagePack がインストールされている状態で NuGet パッケージをインストールできず、それらの単純にライブラリーを削除した場合でもビルドエラーとなりパッケージがある状態が維持されてしまうためです。
"com.cysharp.magiconion": "https://github.com/Cysharp/MagicOnion.git?path=/src/MagicOnion.Client.Unity/Assets/Scripts/MagicOnion#{Version}",
上記の行を下記の通り書き換えます。{Version} はインストールするバージョンに合わせて変更してください。
"com.cysharp.magiconion.client.unity": "https://github.com/Cysharp/MagicOnion.git?path=/src/MagicOnion.Client.Unity/Assets/Scripts/MagicOnion.Client.Unity#{Version}",
StreamingHub のグループ機能が大きく変更となったため、コードレベルでの API 互換性がなくなっています。このため、v6 から v7 に移行する際には v7 での使用方法に変更するか、互換 API shim を使用する必要があります。
StreamingHub を使用している場合、v7 に移行する際に以下の互換 API shim を使用することで段階的な移行を可能にします。ただし、この互換 shim にはグループの InMemoryStorage の機能は含まれていないため、それらの機能を使用している場合には別途対応が必要となります。
using Cysharp.Runtime.Multicast;
namespace MagicOnion.Server.Hubs;
public abstract class StreamingHubBaseCompat<THub, TReceiver> : StreamingHubBase<THub, TReceiver>
where THub : IStreamingHub<THub, TReceiver>
{
protected TReceiver Broadcast(IGroup group) => ((GroupCompat<TReceiver>)group).Inner.All;
protected TReceiver BroadcastExceptSelf(IGroup group) => ((GroupCompat<TReceiver>)group).Inner.Except(ConnectionId);
protected TReceiver BroadcastExcept(IGroup group, Guid except) => ((GroupCompat<TReceiver>)group).Inner.Except(except);
protected TReceiver BroadcastExcept(IGroup group, IReadOnlyList<Guid> excepts) => ((GroupCompat<TReceiver>)group).Inner.Except(excepts);
protected TReceiver BroadcastToSelf(IGroup group) => ((GroupCompat<TReceiver>)group).Inner.Single(ConnectionId);
protected TReceiver BroadcastTo(IGroup group, Guid toConnectionId) => ((GroupCompat<TReceiver>)group).Inner.Single(toConnectionId);
protected TReceiver BroadcastTo(IGroup group, IReadOnlyList<Guid> toConnectionIds) => ((GroupCompat<TReceiver>)group).Inner.Only(toConnectionIds);
protected new HubGroupRepository Group { get; }
protected StreamingHubBaseCompat()
{
Group = new HubGroupRepositoryCompat<TReceiver>(base.Group);
}
class HubGroupRepositoryCompat<T> : HubGroupRepository
{
readonly HubGroupRepository<T> groupRepo;
public HubGroupRepositoryCompat(HubGroupRepository<T> groupRepo)
{
this.groupRepo = groupRepo;
}
public override async ValueTask<IGroup> AddAsync(string name)
=> new GroupCompat<T>(await groupRepo.AddAsync(name));
}
class GroupCompat<T> : IGroup
{
public IGroup<T> Inner { get; }
public GroupCompat(IGroup<T> inner)
{
this.Inner = inner;
}
public ValueTask RemoveAsync(ServiceContext serviceContext)
=> this.Inner.RemoveAsync(serviceContext);
public T1 CreateBroadcaster<T1>() => (T1)(object)Inner.All!;
public T1 CreateBroadcasterTo<T1>(Guid toConnectionId) => (T1)(object)Inner.Single(toConnectionId)!;
public T1 CreateBroadcasterTo<T1>(IReadOnlyList<Guid> toConnectionIds) => (T1)(object)Inner.Only(toConnectionIds)!;
public T1 CreateBroadcasterExcept<T1>(Guid toConnectionId) => (T1)(object)Inner.Except(toConnectionId)!;
public T1 CreateBroadcasterExcept<T1>(IReadOnlyList<Guid> toConnectionIds) => (T1)(object)Inner.Except(toConnectionIds)!;
}
}
public interface IGroup
{
ValueTask RemoveAsync(ServiceContext serviceContext);
T CreateBroadcaster<T>();
T CreateBroadcasterTo<T>(Guid toConnectionId);
T CreateBroadcasterTo<T>(IReadOnlyList<Guid> toConnectionIds);
T CreateBroadcasterExcept<T>(Guid toConnectionId);
T CreateBroadcasterExcept<T>(IReadOnlyList<Guid> toConnectionIds);
}
public abstract class HubGroupRepository
{
public abstract ValueTask<IGroup> AddAsync(string name);
}
void를 지원합니다.StreamingHub 메서드의 반환값으로 void를 지원합니다. 이는 서버의 반환값이 필요 없는 Fire-and-Forget 패턴에서 사용할 수 있습니다.
StreamingHub에서 리시버(receiver)의 메서드 호출을 대기하고, 클라이언트에서의 처리 결과를 서버에서 받을 수 있는 구조를 추가했습니다. 자세한 내용은 클라이언트 결과 페이지를 참조하시기 바랍니다.
StreamingHub에서 내장 하트비트 기능을 추가했습니다. 자세한 내용은 하트비트 (Haertbeat) 페이지를 참조하시기 바랍니다.
MessagePack이 v3로 업그레이드되었습니다. 이로 인해 Unity나 AOT 환경에서 MessagePack Generator(mpc)의 사용이 불필요하게 되었습니다. 자세한 내용은 MessagePack-CSharp의 릴리스를 참조하시기 바랍니다.
StreamingHub의 그룹 백엔드가 Multicaster 기반으로 개선되어, 보다 유연한 그룹 조작이 가능하게 되었습니다. 이에 따라 그룹 관련 API가 변경되었습니다
All, Single, Only, Except 메서드의 추가Broadcast 계열 메서드 및 Group의 CreateBroadcaster 계열 메서드의 삭제자세한 내용은 그룹 및 애플리케이션 관리형 그룹을 참조하시기 바랍니다. 또한 v6에서의 마이그레이션에 관해서는 마이그레이션 가이드도 참조하시기 바랍니다.
Swagger 지원에 사용되던 MagicOnion.Server.HttpGateway가 제거되었습니다. 대신, 요청(Request)/응답(Response)을 JSON으로 인코딩/디코딩하는 MagicOnion.Server.JsonTranscoding이 도입되었으며, Swagger 지원이 추가되었습니다. 더 자세한 정보는 JSON 트랜스코딩 페이지를 참조하시기 바랍니다.
AddLogging과 AddGrpc를 암묵적으로 호출하도록 했습니다.WaitForDisconnectAsync 메서드가 StreamingHub 클라이언트에 추가되었습니다. 이 메서드는 이전의 WaitForDisconnect처럼 연결 해제를 기다리지만, 이제는 연결 해제의 이유를 반환합니다. 이를 통해 하트비트(heartbeat)로 인한 타임아웃과 같은 연결 해제 이유를 얻을 수 있습니다. 더 자세한 정보는 연결 해제 페이지를 참조하시기 바랍니다.
.NET 7은 런타임 지원이 종료됨에 따라 더 이상 지원되지 않습니다. .NET 8 이상을 사용하시기 바랍니다.
StreamingHubContext가 이제 재사용되므로, Hub 메서드 호출 외부에서 StreamingHubContext를 캐싱하면 예기치 않은 동작이 발생할 수 있습니다. 컨텍스트는 호출 중에만 유효합니다.
서버에서 MagicOnion 메서드를 gRPC 메서드로 등록하는 메커니즘을 재설계했습니다. 이는 MagicOnion의 Unary/StreamingHub 서비스를 등록하는 시점을 애플리케이션 빌드에서 요청 파이프라인/라우트 구성으로 변경되었습니다.
AddMagicOnion은 Unary/StreamingHub 서비스를 등록하는 데 사용되었지만, 이제는 MapMagicOnionService로 등록하도록 변경해야 합니다.
Unity에서의 C-core gRPC 라이브러리 지원을 제거했습니다. 대신 grpc-dotnet과 YetAnotherHttpHandler를 사용하시기 바랍니다. 자세한 내용은 Unity 환경에서 사용하기 페이지를 참조하시기 바랍니다.
이전 버전에서는 StreamingHub에서 연결이 해제된 후 클라이언트에서 메서드 호출을 하면 ObjectDisposedException이 throw되었지만, RpcException이 throw되도록 변경되었습니다. 일반적인 클래스와 마찬가지로 Dispose된 경우에만 ObjectDisposedException이 throw됩니다.
일반적인 .NET 애플리케이션과 달리, Unity 클라이언트의 업그레이드에서는 빈 Unity 프로젝트에서 MagicOnion을 설치하고 복사해야 합니다.
이는 Unity 프로젝트에 이미 Unity 패키지 매니저를 통해 MagicOnion이나 MessagePack이 설치된 상태에서는 NuGet 패키지를 설치할 수 없으며, 단순히 이러한 라이브러리를 삭제한 경우에도 빌드 에러가 발생하고 패키지가 있는 상태가 유지되기 때문입니다.
"com.cysharp.magiconion": "https://github.com/Cysharp/MagicOnion.git?path=/src/MagicOnion.Client.Unity/Assets/Scripts/MagicOnion#{Version}",
위의 행을 아래와 같이 다시 작성합니다. {Version}은 설치하려는 버전에 맞게 변경하시기 바랍니다.
"com.cysharp.magiconion.client.unity": "https://github.com/Cysharp/MagicOnion.git?path=/src/MagicOnion.Client.Unity/Assets/Scripts/MagicOnion.Client.Unity#{Version}",
StreamingHub의 그룹(Group) 기능이 크게 변경되어 코드 레벨에서의 API 호환성이 없어졌습니다. 따라서 v6에서 v7로 마이그레이션할 때는 v7의 사용 방법으로 변경하거나, 호환 API shim을 사용해야 합니다.
StreamingHub를 사용하는 경우, v7로 마이그레이션할 때 다음의 호환 API shim을 사용하여 단계적인 마이그레이션이 가능합니다. 단, 이 호환 shim에는 그룹의 InMemoryStorage 기능이 포함되어 있지 않기 때문에, 해당 기능들을 사용하고 있는 경우에는 별도의 대응이 필요합니다.
using Cysharp.Runtime.Multicast;
namespace MagicOnion.Server.Hubs;
public abstract class StreamingHubBaseCompat<THub, TReceiver> : StreamingHubBase<THub, TReceiver>
where THub : IStreamingHub<THub, TReceiver>
{
protected TReceiver Broadcast(IGroup group) => ((GroupCompat<TReceiver>)group).Inner.All;
protected TReceiver BroadcastExceptSelf(IGroup group) => ((GroupCompat<TReceiver>)group).Inner.Except(ConnectionId);
protected TReceiver BroadcastExcept(IGroup group, Guid except) => ((GroupCompat<TReceiver>)group).Inner.Except(except);
protected TReceiver BroadcastExcept(IGroup group, IReadOnlyList<Guid> excepts) => ((GroupCompat<TReceiver>)group).Inner.Except(excepts);
protected TReceiver BroadcastToSelf(IGroup group) => ((GroupCompat<TReceiver>)group).Inner.Single(ConnectionId);
protected TReceiver BroadcastTo(IGroup group, Guid toConnectionId) => ((GroupCompat<TReceiver>)group).Inner.Single(toConnectionId);
protected TReceiver BroadcastTo(IGroup group, IReadOnlyList<Guid> toConnectionIds) => ((GroupCompat<TReceiver>)group).Inner.Only(toConnectionIds);
protected new HubGroupRepository Group { get; }
protected StreamingHubBaseCompat()
{
Group = new HubGroupRepositoryCompat<TReceiver>(base.Group);
}
class HubGroupRepositoryCompat<T> : HubGroupRepository
{
readonly HubGroupRepository<T> groupRepo;
public HubGroupRepositoryCompat(HubGroupRepository<T> groupRepo)
{
this.groupRepo = groupRepo;
}
public override async ValueTask<IGroup> AddAsync(string name)
=> new GroupCompat<T>(await groupRepo.AddAsync(name));
}
class GroupCompat<T> : IGroup
{
public IGroup<T> Inner { get; }
public GroupCompat(IGroup<T> inner)
{
this.Inner = inner;
}
public ValueTask RemoveAsync(ServiceContext serviceContext)
=> this.Inner.RemoveAsync(serviceContext);
public T1 CreateBroadcaster<T1>() => (T1)(object)Inner.All!;
public T1 CreateBroadcasterTo<T1>(Guid toConnectionId) => (T1)(object)Inner.Single(toConnectionId)!;
public T1 CreateBroadcasterTo<T1>(IReadOnlyList<Guid> toConnectionIds) => (T1)(object)Inner.Only(toConnectionIds)!;
public T1 CreateBroadcasterExcept<T1>(Guid toConnectionId) => (T1)(object)Inner.Except(toConnectionId)!;
public T1 CreateBroadcasterExcept<T1>(IReadOnlyList<Guid> toConnectionIds) => (T1)(object)Inner.Except(toConnectionIds)!;
}
}
public interface IGroup
{
ValueTask RemoveAsync(ServiceContext serviceContext);
T CreateBroadcaster<T>();
T CreateBroadcasterTo<T>(Guid toConnectionId);
T CreateBroadcasterTo<T>(IReadOnlyList<Guid> toConnectionIds);
T CreateBroadcasterExcept<T>(Guid toConnectionId);
T CreateBroadcasterExcept<T>(IReadOnlyList<Guid> toConnectionIds);
}
public abstract class HubGroupRepository
{
public abstract ValueTask<IGroup> AddAsync(string name);
}
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
<!-- Release notes generated using configuration in .github/release.yml at 6.1.7 -->
<!-- Release notes generated using configuration in .github/release.yml at 6.1.7 -->
Full Changelog: https://github.com/Cysharp/MagicOnion/compare/6.1.6...6.1.7
<!-- Release notes generated using configuration in .github/release.yml at 6.1.6 -->
<!-- Release notes generated using configuration in .github/release.yml at 6.1.6 -->
Full Changelog: https://github.com/Cysharp/MagicOnion/compare/6.1.5...6.1.6
<!-- Release notes generated using configuration in .github/release.yml at 6.1.5 -->
<!-- Release notes generated using configuration in .github/release.yml at 6.1.5 -->
Full Changelog: https://github.com/Cysharp/MagicOnion/compare/6.1.4...6.1.5
<!-- Release notes generated using configuration in .github/release.yml at 6.1.4 -->
<!-- Release notes generated using configuration in .github/release.yml at 6.1.4 -->
Full Changelog: https://github.com/Cysharp/MagicOnion/compare/6.1.3...6.1.4
<!-- Release notes generated using configuration in .github/release.yml at 6.1.3 -->
<!-- Release notes generated using configuration in .github/release.yml at 6.1.3 -->
Full Changelog: https://github.com/Cysharp/MagicOnion/compare/6.1.2...6.1.3
<!-- Release notes generated using configuration in .github/release.yml at 6.1.2 -->
<!-- Release notes generated using configuration in .github/release.yml at 6.1.2 -->
Full Changelog: https://github.com/Cysharp/MagicOnion/compare/6.1.1...6.1.2
<!-- Release notes generated using configuration in .github/release.yml at 6.1.1 -->
<!-- Release notes generated using configuration in .github/release.yml at 6.1.1 -->
Full Changelog: https://github.com/Cysharp/MagicOnion/compare/6.1.0...6.1.1
<!-- Release notes generated using configuration in .github/release.yml at 6.1.0 -->
<!-- Release notes generated using configuration in .github/release.yml at 6.1.0 -->
Introduced the event OnConnected after a connection is established with a client on the server's StreamingHub.
This differs from OnConnecting in that the client is notified that the connection is complete and can then communicate via Broadcast.
This PR allows DynamicArgumentTuple as a reference type on Unity.
Unity IL2CPP builds often have issues with the code size due to generics and value types.
MAGICONION_USE_REFTYPE_DYNAMICARGUMENTTUPLE build constant allows DynamicArgumentTuple to be treated as a reference type.
This PR introduces an API for diagnosing and tracing the communication of StreamingHub. The API is in preview and may be subject to change in the future.
This API only supports the Source Generator at this moment and you need to set the EnableStreamingHubDiagnosticHandler option to true in the generation options. By setting this option, the StreamingHubDiagnosticHandler property will be added to the generated class, allowing you to set a handler.
namespace MagicOnion.Client;
/// <summary>
/// [Preview] The interface of the handler for StreamingHub diagnostics. This API may change in the future.
/// </summary>
public interface IStreamingHubDiagnosticHandler
{
/// <summary>
/// The callback method at the beginning of a Hub method request. This API may change in the future.
/// </summary>
void OnRequestBegin<THub, TRequest>(THub hubInstance, Guid requestId, string methodName, TRequest request, bool isFireAndForget);
/// <summary>
/// [Preview] The callback method at the end of a Hub method request. This API may change in the future.
/// </summary>
void OnRequestEnd<THub, TResponse>(THub hubInstance, Guid requestId, string methodName, TResponse response);
/// <summary>
/// [Preview] The callback method when a method of HubReceiver is invoked. This API may change in the future.
/// </summary>
void OnBroadcastEvent<THub, T>(THub hubInstance, string methodName, T value);
}
Full Changelog: https://github.com/Cysharp/MagicOnion/compare/6.0.1...6.1.0
<!-- Release notes generated using configuration in .github/release.yml at 6.0.0 -->
<!-- Release notes generated using configuration in .github/release.yml at 6.0.0 -->
This release introduces a source generator for platform that require pre-generated client code (e.g. Unity, NativeAOT, MAUI ...). The source generator also replaces MagicOnion.Generator (moc).
MagicOnion.Client.SourceGenerator is shipped with MagicOnion.Client package. This means that you no longer need to the install generator tool (moc) and setup additional build steps.
Define a partial class with any name of your choosing within the application. Mark it with the MagicOnionClientGeneration attribute, and specify any service type found within the assembly where you want to search for the service interface.
For example, if the MyApp.Shared assembly contains MyApp.Shared.Services.IGreeterService and MyApp.Shared.Hubs.IChatHub, specify one of them.
using MagicOnion.Client;
[MagicOnionClientGeneration(typeof(MyApp.Shared.Services.IGreeterService))]
partial class MagicOnionGeneratedClientInitializer {}
Next, configure MessagePack to use the generated MessagePack Resolver. This is the same as when using the legacy MagicOnion.Generator.
#if UNITY_2019_4_OR_NEWER
[UnityEngine.RuntimeInitializeOnLoadMethod(UnityEngine.RuntimeInitializeLoadType.BeforeSceneLoad)]
#elif NET5_0_OR_GREATER
[System.Runtime.CompilerServices.ModuleInitializer]
#endif
static void RegisterResolvers()
{
StaticCompositeResolver.Instance.Register(
// Add: Use MessagePack formatter resolver generated by the source generator.
MagicOnionGeneratedClientInitializer.Resolver,
MessagePack.Resolvers.GeneratedResolver.Instance,
BuiltinResolver.Instance,
PrimitiveObjectResolver.Instance
);
MessagePackSerializer.DefaultOptions = MessagePackSerializer.DefaultOptions
.WithResolver(StaticCompositeResolver.Instance);
}
You can specify options in the named constructor of the attribute.
DisableAutoRegistration: Sets whether to disable automatically calling Register during start-up. (Automatic registration requires .NET 5+ or Unity)MessagePackFormatterNamespace: Sets the namespace of pre-generated MessagePackFormatters. The default value is MessagePack.Formatters.Serializer: Sets the serializer used for message serialization. The default value is GenerateSerializerType.MessagePack.MagicOnion.Generator (moc) has been removed. The legacy generator is no longer supported.
[!WARNING] While there is currently compatibility between MagicOnion.Client and MagicOnion.Generator (moc), there is no guarantee that this will be maintained.
This PR introduces ServiceContext.SetRawBytesResponse method.
This method allows you to set raw byte sequences as a response. This makes it possible to send a cached response body without serialization.
public override async ValueTask Invoke(ServiceContext context, Func<ServiceContext, ValueTask> next)
{
if (ResponseBytesCache.TryGetValue(context.CallContext.Method, out var cachedBytes))
{
context.SetRawBytesResponse(cachedBytes);
return;
}
await next(context);
ResponseBytesCache[context.CallContext.Method] = MessagePackSerializer.Serialize(context.Result);
}
[!NOTE] The raw byte sequence must be serialized as a MessagePack (or custom serialization) format. MagicOnion will write a byte requence directly into the response buffer.
This release introduces metrics related to StreamingHub using System.Diagnostics.Metrics.
| Metric | Unit | Tags |
|---|---|---|
| magiconion.server.streaminghub.connections | {connection} |
rpc.system, rpc.service |
| magiconion.server.streaminghub.method_duration | ms |
rpc.system, rpc.service, rpc.method |
| magiconion.server.streaminghub.method_completed | {request} |
rpc.system, rpc.service, rpc.method, magiconion.streaminghub.is_error |
| magiconion.server.streaminghub.exceptions | {exception} |
rpc.system, rpc.service, rpc.method, error.type |
| Tag name | Value |
|---|---|
| rpc.system | magiconion |
| rpc.service | StreamingHub interface name (e.g. IGreeterService) |
| rpc.method | StreamingHub method name (e.g. HelloAsync) |
| magiconion.streaminghub.is_error | Whether a StreamingHub method call succeeded or failed. (e.g. true or false) |
| error.type | Thrown exception type (e.g. System.InvalidOperationException) |
This release changes the default gRPC library in Unity to grpc-dotnet. From this release, the recommended gRPC library combination is YetAnotherHttpHandler and grpc-dotnet.
However, at this time, we are still supporting C-core. If you continue to use the C-core gRPC library, please define USE_GRPC_CCORE in "Scripting Define Symbols". We recommend transitioning as there is the possibility of removing support in the future.
refs: #661
Full Changelog: https://github.com/Cysharp/MagicOnion/compare/5.1.8...6.0.0
<!-- Release notes generated using configuration in .github/release.yml at 5.1.8 -->
<!-- Release notes generated using configuration in .github/release.yml at 5.1.8 -->
Full Changelog: https://github.com/Cysharp/MagicOnion/compare/5.1.7...5.1.8
<!-- Release notes generated using configuration in .github/release.yml at 5.1.7 -->
<!-- Release notes generated using configuration in .github/release.yml at 5.1.7 -->
Full Changelog: https://github.com/Cysharp/MagicOnion/compare/5.1.6...5.1.7
<!-- Release notes generated using configuration in .github/release.yml at 5.1.6 -->
<!-- Release notes generated using configuration in .github/release.yml at 5.1.6 -->
Full Changelog: https://github.com/Cysharp/MagicOnion/compare/5.1.5...5.1.6
<!-- Release notes generated using configuration in .github/release.yml at 5.1.5 -->
<!-- Release notes generated using configuration in .github/release.yml at 5.1.5 -->
Full Changelog: https://github.com/Cysharp/MagicOnion/compare/5.1.2...5.1.5
<!-- Release notes generated using configuration in .github/release.yml at 5.1.4 -->
<!-- Release notes generated using configuration in .github/release.yml at 5.1.4 -->
Full Changelog: https://github.com/Cysharp/MagicOnion/compare/5.1.2...5.1.4
<!-- Release notes generated using configuration in .github/release.yml at 5.1.3 -->
<!-- Release notes generated using configuration in .github/release.yml at 5.1.3 -->
Full Changelog: https://github.com/Cysharp/MagicOnion/compare/5.1.2...5.1.3
<!-- Release notes generated using configuration in .github/release.yml at 5.1.2 -->
<!-- Release notes generated using configuration in .github/release.yml at 5.1.2 -->
Full Changelog: https://github.com/Cysharp/MagicOnion/compare/5.1.0...5.1.2
Nothing published for this version
<!-- Release notes generated using configuration in .github/release.yml at 5.1.0 -->
<!-- Release notes generated using configuration in .github/release.yml at 5.1.0 -->
Version 5.0.x series cannot handle null passed in the request and response.
If the request/response is value type (struct) or if the method takes more than one argument, it is not affected, but we strongly recommend upgrading.
ResponseContext<T> class is now abstract and ResponseContext<T>.Create method is used instead of a constructor.
OpenTelemetry to 1.3.2 version by @moreal in https://github.com/Cysharp/MagicOnion/pull/608Full Changelog: https://github.com/Cysharp/MagicOnion/compare/5.0.2...5.1.0
Nothing published for this version
<!-- Release notes generated using configuration in .github/release.yml at 5.0.2 -->
<!-- Release notes generated using configuration in .github/release.yml at 5.0.2 -->
Full Changelog: https://github.com/Cysharp/MagicOnion/compare/5.0.1...5.0.2
<!-- Release notes generated using configuration in .github/release.yml at dbd4f490d04cd6f435bfd16e1784df831524d204 -->
<!-- Release notes generated using configuration in .github/release.yml at dbd4f490d04cd6f435bfd16e1784df831524d204 -->
MagicOnion now supports .NET 7 and we drop support for .NET Core 3.1 and .NET 5 on servers.
Non-generic UnaryResult is the return type of a service method that does not return a value. It replaces UnaryResult<Nil>, which is similar to Task and ValueTask.
// Shared interface:
public interface IMyService : IService<IMyService>
{
UnaryResult MethodAsync(int arg0);
}
// Server-side:
public class MyService : ServiceBase<IMyService>, IMyService
{
public async UnaryResult MethodAsync(int arg0)
{
// Do something ...
// The method does not return any value. (like void, ValueTask, Task)
}
}
// Client-side:
await client.MethodAsync(1234);
UnaryResult has changed from static class to struct.
MagicOnion 5.0 allows ValueTask and ValueTask<T> as a return type of the hub method. Previously, only Task wereTask<T> was allowed.
public interface IMyHub : IStreamingHub<IMyHub, IMyHubReceiver>
{
ValueTask FooAsync();
ValueTask<int> BarAsync();
}
IMagicOnionServiceFilter, IStreamingHubFilterThe filter implementation changes from overriding attributes to implementing interfaces.
IMagicOnionServiceFilterIStreamingHubFilterIMagicOnionFilterFactory<T>IMagicOnionOrderedFilterThis makes for a more flexible implementation, such as implementing both Unary filter and StreamingHub filter.
public class MyDualFilterAttribute : Attribute, IMagicOnionServiceFilter, IStreamingHubFilter, IMagicOnionOrderedFilter
{
public int Order { get; set; } = int.MaxValue;
ValueTask IMagicOnionServiceFilter.Invoke(ServiceContext context, Func<ServiceContext, ValueTask> next) { ... }
ValueTask IStreamingHubFilter.Invoke(StreamingHubContext context, Func<StreamingHubContext, ValueTask> next) { ... }
}
public class MyFilterAttribute : Attribute, IMagicOnionFilterFactory<IMagicOnionServiceFilter>, IMagicOnionOrderedFilter
{
public int Order { get; set; } = int.MaxValue;
public IMagicOnionServiceFilter CreateInstance(IServiceProvider serviceProvider)
=> new FilterImpl();
class FilterImpl : IMagicOnionServiceFilter
{
public ValueTask Invoke(ServiceContext context, Func<ServiceContext, ValueTask> next) { ... }
}
}
This changes MagicOnionFilterAttribute, StreamingHubFilterAttribute as follows:
// 4.x or earlier
public abstract class MagicOnionFilterAttribute : Attribute { ... }
public abstract class StreamingHubFilterAttribute : Attribute { ... }
// 5.0
public abstract class MagicOnionFilterAttribute : Attribute, IMagicOnionServiceFilter, IMagicOnionOrderedFilter { ... }
public abstract class StreamingHubFilterAttribute : Attribute, IStreamingHubFilter, IMagicOnionOrderedFilter { ... }
These have methods for implementation and can continue to be overridden.
IMagicOnionFilterFactory<T> has been moved under MagicOnion.Server.Filters namespace.[Manually ordered filters] -> [Global Filters] -> [Class Filters] -> [Method Filters]
int.MaxValue as the implicit order by default.Read and write directly to the buffer using IBufferWriter when calling Unary. Unary requests can be processed up to 5-10% more efficiently.
request/response parameter from IMagicOnionLoggerMagicOnionLogToLoggerWithDataDump, MagicOnionLogToLoggerWithNamedDataDumpSetRawRequest / GetRawRequest from byte[] to objectChange {Server,Client,Duplex}Streaming message processing on the server to IBufferWriter-based.
data parameter from IMagicOnionLogger.WriteToStream, IMagicOnionLogger.ReadFromStreamMagicOnionClient client now uses IBufferWriter<T>.
Marshaller wrapper API for encryption will be worked on in a separate PR.
RequestMutator and ResponseMutator are no longer supported.
Task<UnaryResult<T>> is no longer supported as a return type of Unary method.
UnaryResult<T> instead.moc (MagicOnion.Generator) is no longer published to GitHub Releases.
MagicOnion uses MessagePack for serialization by default, but it also provides extension points to customize serialization. It allows for customization, such as encryption and the using of serializers other than MessagePack.
IMagicOnionSerializerProvider instead of MessagePackSerializerOptions.MagicOnionOptions.MessageSerializer instead of MagicOnionOptions.SerializerOptionspublic interface IMagicOnionSerializerProvider
{
IMagicOnionSerializer Create(MethodType methodType, MethodInfo? methodInfo);
}
public interface IMagicOnionSerializer
{
void Serialize<T>(IBufferWriter<byte> writer, in T? value);
T? Deserialize<T>(in ReadOnlySequence<byte> bytes);
}
public static class MagicOnionSerializerProvider
{
public static IMagicOnionSerializerProvider Default { get; set; } = MessagePackMagicOnionSerializerProvider.Default;
}
Use ModuleInitializer for automatic registration on .NET 5+. When an application running on .NET 5+ uses a generated client, MagicOnionInitializer.Register() is automatically called.
Option --no-use-unity-attr is obsoleted, please use --disable-auto-register instead.
Adds support for serialization using MemoryPack. (Preview)
Set MemoryPackMagicOnionSerializerProvider to MagicOnionSerializerProvider on the client and server to serialize using MemoryPack.
MagicOnionSerializerProvider.Default = MemoryPackMagicOnionSerializerProvider.Instance;
// or
await StreamingHubClient.ConnectAsync<IMyHub, IMyHubReceiver>(channel, receiver, serializerProvider: MemoryPackMagicOnionSerializerProvider.Instance);
MagicOnionClient.Create<IMyService>(channel, MemoryPackMagicOnionSerializerProvider.Instance);
If you want to use MagicOnion.Generator (moc), you need to specify --serializer MemoryPack as an option.
The generated code will use MemoryPack instead of MessagePack.
The application must also call MagicOnionMemoryPackFormatterProvider.RegisterFormatters() on startup.
UnaryResult() and ReturnNil() helper methods by @mayuki in https://github.com/Cysharp/MagicOnion/pull/589Full Changelog: https://github.com/Cysharp/MagicOnion/compare/4.5.2...5.0.0
<!-- Release notes generated using configuration in .github/release.yml at 4.5.2 -->
<!-- Release notes generated using configuration in .github/release.yml at 4.5.2 -->
Full Changelog: https://github.com/Cysharp/MagicOnion/compare/4.5.1...4.5.2
<!-- Release notes generated using configuration in .github/release.yml at 4.5.1 -->
<!-- Release notes generated using configuration in .github/release.yml at 4.5.1 -->
Full Changelog: https://github.com/Cysharp/MagicOnion/compare/4.5.0...4.5.1
<!-- Release notes generated using configuration in .github/release.yml at 4.5.0 -->
<!-- Release notes generated using configuration in .github/release.yml at 4.5.0 -->
Limit the number of parameters allowed in a Unary/StreamingHub method for Blazor WebAssembly (AOT) to 15.
using when only Grpc.Net.Client is used on Unity in https://github.com/Cysharp/MagicOnion/pull/518Full Changelog: https://github.com/Cysharp/MagicOnion/compare/4.4.1...4.5.0
<!-- Release notes generated using configuration in .github/release.yml at 4.4.1 -->
<!-- Release notes generated using configuration in .github/release.yml at 4.4.1 -->
Full Changelog: https://github.com/Cysharp/MagicOnion/compare/4.4.0...4.4.1
<!-- Release notes generated using configuration in .github/release.yml at cc0bc5ba7753ec56048f9f70a37bad242ff056a3 -->
<!-- Release notes generated using configuration in .github/release.yml at cc0bc5ba7753ec56048f9f70a37bad242ff056a3 -->
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
SynchronizationContext should not be restored when the stream is completed in WebGL #439
Following APIs are marked as deprecated:
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.
Wraps gRPC channels and provides a mechanism to manage them with Unity's lifecycle. This prevents your application and the Unity Editor from freezing
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);
Write a marker that is the beginning of the stream. #411
Fix accessibility of MarshallingAsyncStreamReaderWriter #406
> NOTE: StreamingHubClient.Connect is marked as deprecated. Use ConnectAsync instead.
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.Connectis marked as deprecated. UseConnectAsyncinstead.
# Changes ## Fixes - Better exception message #390
A client sdk getting falsely picked up as a server service through reflection. #387
Raised exception when using RedisGroupRepositoryFactory (#373, #375)
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
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.ClientMagicOnion.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.ILoggerGrpc.Core.Logging.ILogger API is part of C-core library.
DefaultGroupRepositoryFactoryIf 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);
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
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.ClientMagicOnion.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.ILoggerGrpc.Core.Logging.ILogger API is part of C-core library.
DefaultGroupRepositoryFactoryIf 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);
Nothing published for this version
Renewd MagicOnion.OpenTelemery package
Renewd MagicOnion.OpenTelemery package
Add RedisGroupOptions #287 Fix a critical memory out-of-bounds accessing bug of UnsafeDirectBlitResolver #286 Update roslyn version of code generator
Add RedisGroupOptions #287 Fix a critical memory out-of-bounds accessing bug of UnsafeDirectBlitResolver #286 Update roslyn version of code generator
Impemenets RedisGroup.GetMemberCountAsync
MagicOnion.Server.Authentication package provides a simple authentication mechanism on MagicOnion. Currently, the package is marked as 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.
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.IJwtAuthenticationProviderSystem.Security.Principal.IIdentitySample code: https://github.com/Cysharp/MagicOnion/tree/master/samples/JwtAuthentication
⚠NOTE: If you installed the previous version in your project, delete existing MagicOnion package before upgrading.
⚠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.One column per quarter.