Connection
Client events
session.create
Opens the session. The Gateway checks the model, method, access, credit, and capacity once, here. An unknown field is refused.Frame (binary message)
One frame: raw JPEG, PNG, WebP, or GIF bytes, with no base64 and no JSON wrapper. A frame is at mostmax_frame_bytes. Frames are numbered from 1 in the order they arrive, dropped frames included. Each frame gets exactly one event back with its number: result, frame.dropped, or error.
session.close
session.stats and closes with 1000. Any other event after session.create returns invalid_request_error, and the session stays open.
Server events
session.created
result
response.usage.cost is null. The socket does not bill per frame: the session bills by the second, as session.stats.cost.
frame.dropped
A dropped frame is not read. It does not change the session’s price.
error
An
error with a frame applies to that frame, and the session stays open. So does an error for a bad event after session.create, which has no frame. An error at open, or when the session reaches its spend ceiling, is followed by a close.
session.stats
Sent after yoursession.close. A session that the Gateway closes for idle, lifetime, or spend ends without it.
Errors
The Gateway also closes with
1000 and reason idle after 30 seconds with no frame and no read outstanding, and with reason expired at expires_in. What to do after each close code is in Close codes. Session limits are in Rate Limits.