I\'m building a central module that needs to handle multiple users, subscribing them to data changes on their nests.
From what I\'ve been searching, the Node.JS library
You can solve this in the Firebase realtime client libraries by creating a new Firebase.Context
for each user. This is an undocumented second parameter to the Firebase constructor that may change in future releases, but instructs the instance to set up and maintain a new TCP connection rather than sharing the common one.
An example of its use in Node.JS would be:
var Firebase = require('firebase');
var authToken = 'some_long_auth_token';
var userRef = new Firebase('wss://developer-api.nest.com', new Firebase.Context());
userRef.authWithCustomToken(authToken, function(error) {
// Handle auth error
});
There may well be limitations on how many connections Node.JS will allow you to maintain, but I haven't tested them.