Skip to content

feat(pubsub): allow binary channels, not just atoms#390

Open
Taure wants to merge 1 commit into
masterfrom
feat/pubsub-term-channels
Open

feat(pubsub): allow binary channels, not just atoms#390
Taure wants to merge 1 commit into
masterfrom
feat/pubsub-term-channels

Conversation

@Taure

@Taure Taure commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

What

Widen the nova_pubsub channel type from atom() to a new exported channel() type (atom() | binary()), and update the #nova_pubsub.channel record field accordingly.

Why

nova_pubsub is backed by pg, which already accepts any term as a group key - so this is a pure type/spec change with no runtime behaviour change. Atom-only channels force dynamic, per-entity pub/sub (e.g. one channel per tenant) to either mint atoms at runtime (atom table never shrinks) or share a global channel (cross-entity message leakage). Allowing binary channels lets callers use <<"tenant:", Id/binary>>-style channels safely.

Changes

  • nova_pubsub: new -type channel() :: atom() | binary(). (exported + documented), all specs updated.
  • nova_pubsub.hrl: channel field widened to atom() | binary().
  • Test: added a binary-channel join/broadcast/leave case (11 tests pass).

Backwards compatible - existing atom channels are unaffected.

Widen nova_pubsub channel type from atom() to a new channel() type
(atom() | binary()). pg already accepts any term, so this is a pure
type/spec change with no runtime impact. Binary channels let callers
use dynamic, per-entity channels (e.g. per-tenant "tenant:<id>") for
isolated server-push without growing the atom table.

Adds a binary-channel join/broadcast/leave test.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant