How do you store data server side that is specific to a client in Meteor?
javascript, meteor, session
Solution
The user-session smart package I wrote for Meteor is designed exactly for this. It provides all the methods of the Meteor `Session` API (with the exception of `setDefault`), and some additional ones as well. It's reactive, and all the changes are persistent. Best of all, it's available both on the client, and on the server with an additional `userId` argument.
Problem
Express implements a server side session object that lets you store data specific to a client. How would you do the equivalent in Meteor? strack recommended using a collection. This would work if the ids of objects in the collection were session_ids that were exposed both server and client side on the connection objects. It appears the client and server share a session_id via the LivedataConnection on the client: ``` if (typeof (msg.session) === "string") { var reconnected = (self.last_session_id === msg.session); self.last_session_id = msg.session; } ``` and the LivedataSession object on the server: ``` self.id = Meteor.uuid(); ``` But the Meteor API doesn't expose these objects. What is the correct way of accessing the session information? It would be really convenient if a client's Session object synced with a server side Session object unique to the client that is accessible from Meteor#publish and Meteor#methods.