I was going to mess around with a fun experiment where anonymous (i.e. not logged in) users could visit a web page and enter text, which is saved in a database, but once they leave the site, their DB documents are wiped out. I suppose instead of using Meteor’s connection object, I could just have the client generate a random hash and use that to insert documents.
Another way to approach that is to just auto-login users for their session and then delete the user accounts when they log out. Then you can use all the goodies of Accounts instead of rolling your own.
I know this is a super old thread, but for an experiment I would like to get hold of the sessionId on the client, but I can’t seem to manage how to do it. When I register a DDP.onReconnect handler, it prints out the connection Object, which contains _lastSessionId, but when I try to access it is is alway null. What am I doing wrong?
@robfallows thanks for responding. I tried Meteor.connection._lastSessionId first, but it is null. At what stage in bootstrapping the app does it become set? When I attach it to an event handler like a button click, I can see the value, but in autorun or Meteor.startup it is null.