node process doesn't exit after firebase once

firebase, node.js

Solution

Update

Note that this is no longer applicable. Node.js will no longer hang when using once(), although it will be held open as long as there are active listeners subscribed to the remote server.

Original

The Firebase process opens sockets to the server and establishes listeners for incoming data on those connections. Just like a node web server, awaiting incoming HTTP connections, this holds the process open.

To end the process, you can simply utilize process.exit() from inside the callback:

blahFirebase.once('value', function (snapshot) {
    //
    process.exit();
});

Problem

Using node.js with the npm firebase. ``` var firebase = require('firebase'); var blahFirebase = new firebase('https://myfirebase.firebaseIO.com/blah'); blahFirebase.once('value', function (snapshot) { // }); ``` Why does node not exit when it is done reading the data?

Original source

Related problems