Custom error event

event: error
data: {"code": "llm_timeout", "message": "Model unavailable"}

Advertisement

Close with a reason

After sending error event, close the connection. Client's onerror fires; can decide whether to reconnect.

Advertisement

Distinguish transient from fatal

Transient errors: reconnect with backoff. Fatal errors: notify user, don't reconnect (auth revoked, quota exhausted).