Endpoint
token query parameter and is verified during the WebSocket handshake — before the connection is accepted.
Authentication
Authentication uses the same JWT you obtain from the MediSync login flow. See Authentication for how to get a token.A valid MediSync JWT. It must identify a user, and — if the token carries a
permissions list — that list must include "transcribe".Token is valid
The JWT signature and expiry are verified. An invalid, malformed, or expired token is rejected.
Token identifies a user
The token must resolve to a user identity. A token with no user identity is rejected.
If any of these checks fails, the socket is closed with code
1008 during the handshake — before the connection is accepted. No session_ready and no JSON error frame are delivered in this case; the close code is the signal.Handshake sequence
Send the config frame (first message)
Your first message must be a single JSON
config text frame. Send it as soon as the socket opens. The server waits about 10 seconds for it; if none arrives it closes with a config_timeout error.Receive session_ready
The server replies with a
session_ready frame containing your session_id and the effective config. Only now should you begin streaming audio.Stream & finish
Send binary audio frames, then flush with
end_utterance and end with close. See Messages.Connect (full example)
Close codes
| Code | Meaning | When |
|---|---|---|
1008 | Policy violation — authentication failed | Invalid/expired token, no user identity, or missing transcribe permission. Sent during the handshake, before acceptance. |
1000 / 1005 | Normal closure | The session ended cleanly — you sent close, or the server closed after delivering a fatal error frame. |
1011 | Server error | An unexpected server-side condition ended the session. Usually preceded by an internal_error frame. |
For a fatal application error after the socket is accepted (for example
session_conflict or overloaded), the server first sends a JSON error frame with "fatal": true and then closes the socket. Branch on the error code, not only on the close code. See Errors.Next steps
Session config
Every config field, defaults, and the
session_ready echo.Messages
Audio frames, control frames, and the transcript schema.