DEV Community

Florian
Florian

Posted on Edited on

The provider still bills the open STT socket after the browser hangs up

Gladia bills the upstream live WebSocket by wall clock. A Socket.IO blip can drop the browser while that job is still open.

On detach the service flushes provider cost and user billing, then sets socketDetached. flushWallClockBilling skips a session once that flag is set, so the user side stays at the flush. flushPeriodicCost keeps running. The open Gladia socket is still provider spend, and that path still feeds the daily kill-switch.

Detach grace is 8 seconds, from env. A reload gets a new Gladia id. The previous job is not resumed, and only one live slot is allowed.

LiveSuggest splits those two flushes so the blip does not have to close the STT job.

Top comments (2)

Collapse
 
abhinavs1920 profile image
Abhinav Sharma •

The wall-clock-billing gap is the sneaky one: the client-side disconnect is visible, the upstream socket is not, so the leak only shows up on the provider invoice. A server-side idle timeout on the upstream socket as a backstop to the detach path closes that gap between the two.

Collapse
 
florian131313 profile image
G •

The 8 second grace is already the close delay after detach. Provider spend in that window is on purpose: the upstream stays open in case the browser comes back. An idle timeout only matters when the browser socket still looks attached and no audio arrives, so detach never runs.