Multiple, simultaneous user sessions?

Not sure whether this would be helpful, but I thought of this thread when I stumbled across this:

Registering your server function under a different name

Server functions don’t have to take the name of the function they’re decorating. You can pass a string into the decorator to anvil.server.call them by a different name.

@anvil.server.callable("my_func")
def foo():
  return 42

This can be calculated at runtime, so if you have multiple Uplink connections, you can append an ID based on which instance of the Uplink you’re connecting from.

import uuid
UPLINK_ID = uuid.uuid4()

@anvil.server.callable("my_func%s" % UPLINK_ID)
def foo():
  return 42

This is the section of the docs that this comes from.

2 Likes