Urgent.News

What's breaking now, across thousands of outlets.

Tech

Push to Talk: the Backend Problem Is Not Audio, It Is Partial State

Push to talk looks like a small feature. Record, send, play. The backend tells a different story, and the whole thing turns on one requirement that sounds impossible the first time you hear it. The receiver starts hearing the message before the sender has finished recording. Everything below is a consequence of that one line. The audio is not a file, it is a stream of fragments The app pushes…

Push to talk functionality appears straightforward at first glance—the process involves recording, sending, and playing audio messages. However, the underlying backend architecture presents a more complex challenge, particularly concerning the partial state of audio streams. The core issue lies in the server's need to handle partial state for numerous messages concurrently while determining whether a recording is still ongoing or if the device experienced an interruption shortly after recording. This seemingly simple requirement forms the crux of the entire system's design.

Audio is treated as a continuous stream of fragments rather than a standalone file. As the user records, the app transmits these audio fragments over an open connection to the server, enabling real-time playback. The server maintains the fragmented state for a significant number of messages simultaneously, necessitating a robust mechanism to ascertain whether a recording is still active or if the user's device failed mid-recording. This determination is fundamental to the system's operation.

To ensure horizontal scalability and fault tolerance, all per-message state is stored in a shared database, with each message identified by a unique key. This design allows any ingest node to accept the next fragment from any client without being bound to local memory states. Once the data ingestion phase completes, subsequent tasks such as assembly, transcoding, notifications, and expiration are handled by background workers, keeping the upload path free from any potential delays.

The messaging system employs a sequence numbering system for fragments, ensuring that fragments carry idempotent writes. This approach allows mobile clients to retry failed transmissions without duplicating audio segments in the system.

The architecture incorporates an explicit state machine tracking the audio message's lifecycle, progressing through stages like complete, delivered, expired, and failed. An explicit completion signal signifies when a message has been fully processed. Messages that become abandoned are automatically timed out and have their storage released to prevent uncontrolled data growth.

Choosing the right codec is crucial; the system must support decoding partial streams, eliminating formats that only become meaningful once the final byte is delivered. This decision impacts the overall design and long-term operational costs.

Retention policies are embedded as design specifications within the system, ensuring that voice data, which is considered personal information, is automatically purged after the designated retention period. Metadata and fragments carry a time-to-live that aligns with the retention rules, facilitating timely deletion without relying on manual cleanup jobs.

Monitoring the system focuses on key performance indicators, including queue depth, queue age, ingest latency, time to the first playable byte, transcoding duration, storage errors, and expiry backlog. The queue age is particularly critical as it serves as an early warning indicator, alerting the system to potential issues before they escalate.

The backend is implemented using PHP on AWS, with S3 for audio storage, SQS for queued work, Couchbase for metadata and fragments managed with time-to-live settings corresponding to the retention policy. Supervised worker daemons handle various tasks, with Zabbix providing comprehensive monitoring across the system. The ultimate goal is to ensure that the user experience is flawless, and any shortcomings are promptly addressed through robust monitoring and alerting mechanisms.

The system is engineered to handle the worst-case scenario, where users encounter issues with individual messages, ensuring a high-quality end-user experience.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Idempotent webhooks in Node.js: handle every event once, even when it's delivered twice

Webhook providers deliver at least once : if your endpoint is slow, returns an error, or the response is lost on the way back, they send the same event again.

  • Webhook providers deliver events at least once, requiring idempotent handling.
  • Claim event ID in database with unique constraint to prevent duplicate processing.
  • Respond quickly and use provider's event ID to maintain idempotency and clean database.

Hand Off Your Vector Search POC: A README and RECREATE.md for Amazon OpenSearch Service

The proof of concept worked in my account. The real test was whether the customer's team could build it again in theirs. A customer evaluating Amazon OpenSearch Service as a vector store asked for two…

  • Amazon OpenSearch Service handled 300 queries per second with 4,096-dimensional vectors
  • CloudFormation template deployed OpenSearch 3.7 with r8gd.8xlarge data nodes in VPC
  • Faiss HNSW indexing with GPU acceleration achieved sub-50ms latency

What Is a ClickFix Scam? How a Fake CAPTCHA Installs Malware

Originally published at warnscams.com You click “Verify you are human.” A small window pops up. It asks you to press Windows + R, then Ctrl + V, then Enter.

  • ClickFix scam deceives users with fake CAPTCHAs to run malicious commands.
  • Users click links from compromised websites leading to the scam page.
  • Fake CAPTCHA instructs pressing Windows + R, Ctrl + V, and Enter to install malware.

Stakeholder Alignment Plan: A Practical Decision Framework

Stakeholder Alignment Plan: A Practical Decision Framework A stakeholder alignment plan decision framework is a structured set of rules that defines who makes which calls, what trade-offs govern those…

  • Stakeholder alignment plan defines responsibility and resolution procedures.
  • Four decision criteria: strategic value, reversibility, blast radius, and time-to-impact cost.
  • Tiered framework routes decisions based on risk level and enables bold decisions.

More from Wednesday 18 November →