Cysharp / MagicOnion

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

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

Closed mayuki closed 4 months ago

mayuki commented 4 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);
}