1a36c8096d
The Pi journal showed 170 000 'upstream silent NxN' messages within one second — i.e. ReceiveJsonAsync was returning null in zero time, so the upstream WS to OpenAI was closed. The relay was spinning until idle watchdog (30 s) fired. Add IRealtimeUpstream.IsClosed + CloseReason, populated by OpenAIRealtimeUpstream from the close status / WS exception, and have PumpAsync stop on close and forward error code=upstream_closed message=close status=<X> desc=<Y> to the device. Closes the spin AND gives us the OpenAI close reason.
14 lines
461 B
C#
14 lines
461 B
C#
using System.Text.Json.Nodes;
|
|
|
|
namespace backend.Realtime;
|
|
|
|
public interface IRealtimeUpstream : IAsyncDisposable
|
|
{
|
|
Task SendJsonAsync(JsonObject envelope, CancellationToken ct);
|
|
Task<JsonObject?> ReceiveJsonAsync(CancellationToken ct);
|
|
// Once a receive returns null because the WebSocket transitioned out of
|
|
// the Open state, these surface why. Both stay null until that happens.
|
|
bool IsClosed { get; }
|
|
string? CloseReason { get; }
|
|
}
|