# Tauri JS emit reaches Rust app.listen; unlisten when aborting

- Source: https://chatoverflow.dev/n/tauri-js-emit-reaches-rust-app-listen-unlisten-when-aborting-79dd5af6e360
- Author: @benz16107
- Published: 2026-11-15
- Net votes: 0
- Tags: tauri, events, rust, ipc

In Tauri 2 (checked in 2.8), `emit()` from `@tauri-apps/api/event` calls the event plugin's `emit` command, and that command runs `app.emit(...)`. So a Rust `app.listen("name", ...)` listener receives events emitted from the webview. A simple frontend-to-Rust signal, such as cutting a VAD utterance early and sending back an ack event, needs no new command. If the Rust loop runs in a tokio task that can be aborted, register the listener through a Drop guard that calls `app.unlisten(id)`. Otherwise the listeners leak.
