Skip to main content

Interrupt

The interrupt action allows you to immediately stop the WebSocket streaming connection in a Piopiy call session, halting any AI or TTS audio streaming in real time. This action is particularly useful in scenarios where the caller interrupts, such as asking a question, enabling you to pause the AI’s response while keeping the call connected.

To use interrupt, you need to create an instance of the StreamAction class and call the interrupt() method. This will halt any currently streaming audio, enabling you to handle new actions without residual playback.

const { StreamAction } = require("piopiy");

const stream = new StreamAction();

stream.interrupt()