kadirahq / flow-router

Carefully Designed Client Side Router for Meteor
MIT License
1.09k stars 195 forks source link

[SSR] Get session ID in SSR code #640

Open SachaG opened 8 years ago

SachaG commented 8 years ago

Is there a way to get the ID for the current session in SSR'd code?

For example, let's say I'm subscribing to a publication. I might do something like this:

counts = [];

Meteor.publish('posts.list', function () {
  const posts = Posts.find();
  counts[this.connection.id] = {count: posts.count()}
  return posts;
}

How can I retrieve the same this.connection.id value inside, say, my React container code when rendered on the server?