I want to add a new function to my app to retrieve all Session key/values at a specific point in time (basically when a specific error happens) and then send this either to the Backend server or to a log file.
I know that this was something that MeteorToys originally could do as it listed them.
How can this be achieved without know the key of each Session?
I know it’s a reactive dictionary underneath from the 'meteor/session' package.
It does work in the Developer Tools but now I need to figure out how I can do it in the code/Electron app itself and then store the result in array of objects.
That is ok. It means you have no key :). Just initiate a key and it should probably work. You can run it in a browser console. I believe you work on Electron, just try it in a browser to make sure Electron is not bugging you on this one.
I do have lots of keys (over 50), hence my question. The old version of Meteortoys even allowed them to be overlayed in Dev environment.
Yes, I work in Electron but it has the Chrome Developer Tool from which is the screenshot.
So I’m puzzled why the code isn’t showing anything, no matter where I put it when there are indeed many keys that I actively use to show/hide UI elements, indicate if features are unlocked etc.
My solution will need a lot of refactoring but might solve your problem. I’m creating enums for nearly everything including pub/subs, collection names, event names, session keys etc… Just walking in this enum object will give what you want with typo safety and ide suggestions.
Besides that, using session means using globals and you should avoid it as much as possible. Instead you can use reactive vars which will be destroyed on template desctruction.