Cysharp / MagicOnion

Unified Realtime/API framework for .NET platform and Unity.
MIT License
3.9k stars 433 forks source link

Add support for void as a return type for StreamingHub #772

Closed mayuki closed 6 months ago

mayuki commented 6 months ago

This PR adds support for void as a return type for StreamingHub. It is more efficient in cases where the client fires-and-forgets the request and the processing is synchronous on the server.

public interface IGreeterHub : IStreamingHub<IGreeterHub, IGreeterHubReceiver>
{
    void Hello();
}
public class GreeterHub : StreamingHubBase<IGreeterHub, IGreeterHubReceiver>
{
    private int _count;
    public void Hello() => Interlocked.Increment(ref _count);
}