revelrylabs / elixir-nodejs

An Elixir API for calling Node.js functions
MIT License
215 stars 31 forks source link

Can Node.js keep state? #69

Closed cheerfulstoic closed 3 years ago

cheerfulstoic commented 3 years ago

So this library keeps a set of workers in a pool to interface with Node.js. If I want to execute some Node.js code, is it possible to have an ongoing session or state? That is, if I make the same function call more than once I might get a different result back the second or third time? And, if so, would I need to have a "sticky session" with the user to make sure I get the same ongoing state?

I could write some JS code to store things or disk or in a DB and I might just do that, but I wanted to check first what this library is capable of. Thanks! 😊

cheerfulstoic commented 3 years ago

Ah ha! I found this comment which mentions setting NODE_ENV=production, and that has suddenly given me state! If I start up different iex -S mix sessions I get different state, which is interesting, and I'd love to understand that, but it's working how I'd like, so I'm happy for now! 😁 Thanks!