Push-to-Talk Backend for a Popular Messaging App

Push-to-Talk Voice Messaging Backends

Industry
Media & Entertainment, Telecommunications, Software products
Technologies
PHP, AWS, Cloud

Summary

We build push-to-talk voice messaging backends. Push-to-talk turns a held button into a short voice message that the recipient can begin hearing while the sender is still speaking. The backend behind it accepts audio as it is being recorded, stores it durably, makes it available for download almost immediately, notifies recipients, and cleans up once the message has been delivered and its retention window has passed. None of it is visible in the interface, and all of it is felt.

The Challenge

Latency, gaps and failed sends are exactly what users notice, so a service of this kind is judged on tail behaviour rather than average throughput. The mechanism that makes the feature feel immediate is also what makes it hard: audio is uploaded in fragments while recording is still in progress, which means the server is holding partial state for many messages at once and has to distinguish a truncated recording from one still being spoken.

Ordering and partial failure are the real difficulty. Codec choice and container framing must permit decoding from a partial stream, and mobile networks drop and resume connections mid-message, so resumption from the last acknowledged sequence has to be a normal path rather than an error case. Underneath all of it sits voice data that is personal by nature, which makes retention and deletion guarantees a design input rather than an afterthought.

The Solution

Tier Separation and State

The service divides into an upload and download tier, a background processing tier, a durable object store and a fast temporary store. Keeping the ingest tier stateless is what allows it to scale horizontally behind a load balancer: all per-message state belongs in the shared store, keyed by message identifier, so any node can accept the next fragment of a message that another node started. Workers run as supervised daemons that consume the queue, assemble and transcode audio, publish notifications, and expire stale records. The fast ingest path is kept clear of anything that can block it, including transcoding and notification fan-out, both of which move behind the queue.

Chunked Ingest and Progressive Download

The sending application splits the recording into short fragments and pushes them over a persistent keep-alive HTTP connection as they are captured, rather than waiting for the button to be released. The server appends each fragment, tracks sequence numbers and the terminal marker, and exposes a progressive download so the receiving application can begin playback before the final fragment arrives.

Ordering, Idempotency and State

  • Fragments carry sequence numbers and idempotent writes, so a retried upload never duplicates audio.
  • An explicit completion signal separates a finished message from one still in progress.
  • Abandoned messages expire on a timeout that releases their storage.
  • Each message has an explicit state machine covering recording, complete, delivered, expired and failed, instead of state being inferred from the presence of files.
  • Resumption from the last acknowledged sequence is treated as a normal path.

Operations, Monitoring and Testing

Instrumentation covers queue depth and queue age, fragment acceptance latency, time from first fragment to first byte available for download, transcoding duration, storage errors and expiry backlog. Monitoring alerts on queue age rather than error rate alone, because a slowly draining queue degrades the feature long before anything actually fails. Deployment scripts with separate configuration per environment, and thorough unit testing of fragment assembly and the message state machine, are not optional in a component where a defect silently corrupts audio. Load testing uses realistic concurrency of simultaneous in-flight messages rather than sequential uploads, because the interesting failures only appear when many partial messages are open at once.

What This Delivers

Recipients start hearing a message while it is still being spoken, which is the whole point of the feature. Senders on unreliable mobile networks recover from interruptions without losing what they have already said. Storage stays bounded because expiry is part of the state machine rather than a cleanup script. Operators see degradation building in queue age before users report it, and the retention and privacy position is explicit rather than emergent.

Technologies and Tools

  • PHP application tier on AWS cloud infrastructure
  • S3 for durable audio storage; SQS for processing and delivery work
  • Couchbase for message metadata, chunk state and in-flight fragments with a time-to-live matching retention policy
  • Supervised worker daemons for assembly, transcoding, notification and expiry
  • Zabbix or an equivalent for monitoring and alerting