Skip to content

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

Merged
Taure merged 1 commit into
masterfrom
feat/pubsub-term-channels
Aug 8, 2026
Merged

feat(pubsub): allow binary channels, not just atoms#390
Taure merged 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.
@burbas

burbas commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Looks alright

@Taure
Taure merged commit abcea71 into master Aug 8, 2026
14 checks passed
@Taure
Taure deleted the feat/pubsub-term-channels branch August 8, 2026 19:54
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.

2 participants