Skip to main content

Scope

A scope defines the namespace and the life cycle of the scoped entity instance.

A scoped entity exists as long as its scope exists. For example, if something is scoped to a group, it will be deleted when the group is deleted.

Scope can also determine access rights to the scoped entity. For example, a user can access a chat room if the chat is scoped to a point in the hierarchy to which the user has access rights, like being a participant in the group to which the chat is scoped.

Defining scope

A scope is defined as:

  • The scope boundary which is a type of entity within the Epicenter hierarchy (such as an account, project, group, episode, or world).
  • A scopeKey which is the unique GUID of the specific instance of that entity.
note

Because scope is defined by an entity type and GUID, it does not include any of the lower level scopes. For example, an entity scoped to a group can have the same name as another entity scoped to the project that contains the group.

User-specific scope

You can subdivide a scope by assigning a user key to it. When you add a userKey to a scope, you create a new unique namespace. However, the lifecycle of this user-specific namespace is still determined by the scopeKey.

For example, multiple group-scoped chats can belong to the same group if the user keys are different. However, all these chats will be deleted when the group is deleted.

learn more

In the JS libraries, scope is implemented by the Generic scope interface, which does not include a user key. For an example of using scope in a function, see the run adapter reference.