PhoenixKitProjects.PubSub (PhoenixKitProjects v0.1.1)

Copy Markdown View Source

Real-time updates for the projects module, backed by PhoenixKit.PubSub.Manager.

Topics

  • "projects:all" — any project/template/task/assignment mutation
  • "projects:tasks" — task library mutations
  • "projects:templates" — template project mutations
  • "projects:project:<uuid>" — updates scoped to one project

Events

Messages are {:projects, event_atom, payload_map} tuples.

Tenant scoping (deferred)

Topics are global today. PhoenixKit core does not currently expose a per-tenant Scope.organization_id or equivalent, and no other feature module (locations, staff, sync, …) does multi-tenant PubSub partitioning either — so this is a framework-wide gap, not a projects-specific one.

When core grows tenant scoping, the right shape here is to thread the org/tenant key into every topic ("projects:org:<org_id>:all", etc.) and have subscribe/1 raise if the scope is missing. Until then, the :project:<uuid> topic is the only one safe against cross-tenant fan-out (you need the UUID to subscribe), and the :all / :tasks / :templates topics deliberately broadcast across all subscribers.

Summary

Functions

Broadcasts an assignment event to the all-projects and the parent project's topic.

Broadcasts a dependency event to the all-projects and the parent project's topic.

Broadcasts a project event. Templates also fan out to the templates topic.

Broadcasts a task-library event to the all-projects and tasks topics.

Subscribes the calling process to the given PubSub topic.

Topic for any project, template, task, or assignment mutation.

Topic scoped to a single project.

Topic for task-library mutations.

Topic for template-project mutations.

Functions

broadcast_assignment(event, payload)

Broadcasts an assignment event to the all-projects and the parent project's topic.

broadcast_dependency(event, payload)

Broadcasts a dependency event to the all-projects and the parent project's topic.

broadcast_project(event, payload)

Broadcasts a project event. Templates also fan out to the templates topic.

broadcast_task(event, payload)

Broadcasts a task-library event to the all-projects and tasks topics.

subscribe(topic)

Subscribes the calling process to the given PubSub topic.

topic_all()

Topic for any project, template, task, or assignment mutation.

topic_project(uuid)

Topic scoped to a single project.

topic_tasks()

Topic for task-library mutations.

topic_templates()

Topic for template-project mutations.