firebase / firebase/firebase-functions
streaming callable API: client aborted stream -> how to know on server?
- Dominant language
- TypeScript
- Stars
- 1.1k
- Forks
- 232
- Avg merge
- 20h 46m
- Merged PRs (30d)
- 15
Description
I am testing the new streaming API for cloud functions in emulator.
Aborting streams with an AbortController on my client works fine.
How can the called function know that the user canceled the stream? The CallableResponse signal does not fire an event.
I want to pass an abort signal to the AI API I am calling in the function.
```
export const aiStreamText = onCall(
async (request, response) => {
response?.signal.addEventListener("abort", () => {
console.log(new Date().toISOString(), "on server: aborted by user"); // THIS DOES NOT FIRE ON ABORT
});
```
### Related issues
### [REQUIRED] Version info
**node:**
**firebase-functions:**
**firebase-tools:**
**firebase-admin:**
### [REQUIRED] Test case
### [REQUIRED] Steps to reproduce
### [REQUIRED] Expected behavior
### [REQUIRED] Actual behavior
### Were you able to successfully deploy your functions?
Contributor guide
Assessment
This issue has not been assessed yet.