Multiplex users into one group


#1

Consider multiplex if you’re using REST Streaming to manage more than 50 users in a Cloud-to-Cloud integration. With multiplex, you can read data in near real-time from many user devices with a single HTTPS connection. Plus, we added advice on how to manage multiple multiplex connections:

  • When to create a new multiplex connection
  • What to do when an access token is invalid or missing
  • How and when to reestablish multiplex connections

For more information see the Multiplex overview


#2

Can you explain how to group this?

Using EventSource, I get that you just make a request to https://developer-api.nest.com/multiplex and add a list of access tokens to the Authorization header

What I don’t understand is when it talks about grouping these connections

Continue in this manner, first creating multiplex connections (10-20), then multiplex group connections (<300), as needed.
• Each multiplex connection replaces the individual user connections.
• Each multiplex group connection replaces the multiplex connections.

So I would have something like the following:

var esInit = { headers: {'Authorization': 'Bearer token1,token2.......token20'}}
var source = new EventSource('https://developer-api.nest.com/multiplex', esInit);

source.addEventListener('put', function(e) {
  //Do something
}

So now I have my single collection of 20 tokens. What do I when I need more, do I have to create another EventSource?

var esInit = { headers: {'Authorization': 'Bearer token21,token2.......token30'}}
var source2 = new EventSource('https://developer-api.nest.com/multiplex', esInit);

Then we have the group limit of 300, hence why you can see how I’m getting a bit confused.

Is there any further documentation on this or examples?


#3

I too found this documentation confusing.

I am currently needing to poll multiple users at once to get their home and away status.