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.
- Node.js
- Python
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()
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.
from piopiy import StreamAction
stream = StreamAction()
stream.interrupt()