Jump to top

HttpsCallable

interface

An HttpsCallable is a reference to a "callable" http trigger in Google Cloud Functions.

Example
// Create an HttpsCallable reference
const reference = firebase.functions().httpsCallable('order');

try {
 const response = await reference({
   id: '12345',
 });
} catch (e) {
 console.error(e);
}
Streaming Example
const reference = firebase.functions().httpsCallable('streamingFunction');
const unsubscribe = reference.stream({ input: 'data' }, (event) => {
  if (event.error) {
    console.error('Stream error:', event.error);
  } else if (event.done) {
    console.log('Stream completed');
  } else if (event.text) {
    console.log('Stream chunk:', event.text);
  }
});

// Later, to stop the stream:
unsubscribe();

Methods

stream

</>

Start a streaming request to the callable function.

stream(data?:  | null, onEvent?: undefined | (event: HttpsCallableStreamEvent) => void, options?: HttpsCallableOptions): () => void;