Error frame
When something goes wrong after the socket is accepted, the server sends a JSONerror frame:
string
Always
"error".string
A short, human-readable, content-free description. Safe to log. Never contains audio or transcript text.
boolean
When
true, the session cannot continue: the server closes the socket immediately after this frame. When false, the session continues and you may keep streaming.Error codes
auth_failed is special: authentication is checked during the handshake, so a failure is signaled by closing the socket with code 1008 rather than by an in-session JSON error frame. Detect it in your onclose handler.Fatal & close semantics
1
Handshake rejection (auth)
An authentication failure closes the socket with code
1008 before acceptance. There is no session_ready and typically no JSON error frame.2
In-session fatal error
After acceptance, a fatal condition is sent as an
error frame with "fatal": true, and the server then closes the socket. Handle the frame, then treat the close as expected.3
Non-fatal error
An
error frame with "fatal": false is informational — the session stays open and you can keep streaming.4
Clean close
You end a session with a
close control frame (or by closing the socket). The server finalizes any buffered audio first.Error handling
Backpressure handling
Backpressure is not an error — it is a flow-control signal telling you that audio is arriving faster than the session can finalize it.string
Severity, for example
"warn".integer
How many buffered segments were dropped to keep the session live (
0 on an early warning, before anything is dropped).1
Send closer to real time
Pace your binary frames to the audio’s own duration. The most common cause is streaming a file or backlog far ahead of real time.
2
Reduce burst size
Send smaller, more frequent frames rather than large bursts.
3
Recover dropped audio if needed
If
dropped_segments > 0 and you cannot tolerate the gap, use your buffer and the reconnection primitives to resend audio after the last processed_until.A
backpressure frame may include additional advisory numeric fields; treat them as opaque. The correct response is always to slow the send rate toward real time.status frames
Not every notification is an error. The server may send astatus frame for informational session-state changes:
idle_timeout means the session received no audio for an extended period (roughly two minutes) and is being closed. Keep a session alive by sending audio, or an end_utterance, periodically.
Getting help
Contact support
If you hit an error you cannot resolve, email support@medisync.me with the error
code, message, and the time of the failure. Never include audio, transcript text, or your JWT.Next steps
Reconnection
Recover from fatal drops with no lost transcript.
Connection
Close codes and the handshake sequence.