feat: implement verbose mode (+OK after commands)
When a client sends CONNECT {"verbose":true}, the server now responds
with +OK\r\n after successfully processing CONNECT, PING, SUB, UNSUB,
and PUB/HPUB commands, matching the Go NATS server behavior.
This commit is contained in:
@@ -235,6 +235,8 @@ public sealed class NatsClient : IDisposable
|
||||
{
|
||||
Interlocked.Exchange(ref _lastActivityTicks, DateTime.UtcNow.Ticks);
|
||||
ProcessPub(cmd, ref localInMsgs, ref localInBytes);
|
||||
if (ClientOpts?.Verbose == true)
|
||||
WriteProtocol(NatsProtocol.OkBytes);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -292,10 +294,14 @@ public sealed class NatsClient : IDisposable
|
||||
{
|
||||
case CommandType.Connect:
|
||||
await ProcessConnectAsync(cmd);
|
||||
if (ClientOpts?.Verbose == true)
|
||||
WriteProtocol(NatsProtocol.OkBytes);
|
||||
break;
|
||||
|
||||
case CommandType.Ping:
|
||||
WriteProtocol(NatsProtocol.PongBytes);
|
||||
if (ClientOpts?.Verbose == true)
|
||||
WriteProtocol(NatsProtocol.OkBytes);
|
||||
break;
|
||||
|
||||
case CommandType.Pong:
|
||||
@@ -304,10 +310,14 @@ public sealed class NatsClient : IDisposable
|
||||
|
||||
case CommandType.Sub:
|
||||
ProcessSub(cmd);
|
||||
if (ClientOpts?.Verbose == true)
|
||||
WriteProtocol(NatsProtocol.OkBytes);
|
||||
break;
|
||||
|
||||
case CommandType.Unsub:
|
||||
ProcessUnsub(cmd);
|
||||
if (ClientOpts?.Verbose == true)
|
||||
WriteProtocol(NatsProtocol.OkBytes);
|
||||
break;
|
||||
|
||||
case CommandType.Pub:
|
||||
|
||||
Reference in New Issue
Block a user