1
0
mirror of https://github.com/chylex/Minecraft-Phantom-Panel.git synced 2025-10-01 08:02:49 +02:00
Files
Minecraft-Phantom-Panel/Utils/Phantom.Utils.Rpc/Runtime/Server/IRpcServerClientHandshake.cs

18 lines
612 B
C#

using Phantom.Utils.Monads;
namespace Phantom.Utils.Rpc.Runtime.Server;
public interface IRpcServerClientHandshake<T> {
Task<Either<T, Exception>> Perform(bool isNewSession, RpcStream stream, CancellationToken cancellationToken);
}
public static class RpcServerClientHandshake {
public readonly record struct NoValue;
public sealed record NoOp : IRpcServerClientHandshake<NoValue> {
public Task<Either<NoValue, Exception>> Perform(bool isNewSession, RpcStream stream, CancellationToken cancellationToken) {
return Task.FromResult<Either<NoValue, Exception>>(Either.Left(new NoValue()));
}
}
}