Let’s think about this for a minute.
Assume, for the moment, that 10 different users are logged in to your app, so there are 10 distinct client instances running, each in a different browser. When an endpoint receives a request, at the server, which one of those 10 clients’ data should it see? How should it decide?
Actually, since an endpoint could receive a request from anyone, anywhere, the request is not tied to any specific client. Anvil starts up a brand-new instance of your server program, and routes the request to that instance. No client required.
The same happens with ordinary anvil.server.call
requests from a client. An instance starts up, and handles the request. Each instance has its own memory area, so that information from different clients does not get mixed together.
Now, any server instance is likely to shut down in a matter of seconds, to let other server instances run. So server-side global variables from any one client may not live for very long.
To help you deal with that, there is one special server-side variable, which does persist between calls, one instance per connection. This variable is named anvil.server.session.
If you want to pass information between server program instances, you will need something that outlives these instances. There is such a thing. Database table rows outlive all instances.
So to pass information, you will want to put it in a database table, with enough identifying information that a later instance can find it.