[Solved] How can I subscribe to many NEST devices from many different users using a single Node.JS server


Firebase engineer here,

The problem with this current approach is that Nest currently only allows a single token to authenticate at a time, and since Firebase clients cache authentication state once authenticated, in order to do this in a single process on one of said servers, you would have to auth, perform the operation, then unauth, and repeat for every operation which isn’t very efficient. Listens are particularly inefficient, since this means you need to open up n socket connections, and having to switch between them in this manner somewhat defeats the purpose of using Firebase in the first place (being able to hold the connection open and get pushed updates).

You can solve this in a few ways:

  • Switch to multi-process and multi-server where each process has an open socket and its own auth token. Using our Node or Java client is typically the best option here.
  • Use the streaming REST API to open up multiple connections on the same server.

Hope this helps!

solved How can I subscribe to many NEST devices from many different users using a single Node.JS server