Push channel JSON over binary

Open
#5,815 5 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
28/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
elixir

Research direction

Start by tracing Phoenix Channels push serialization and the existing binary-frame handling, then check how Bandit and Cowboy validate text frames. Done means JSON pushes use binary frames without a serializer-version change, with any client text-mode compatibility behavior and regression coverage resolved.

Written by the indexing model from the issue text.

Description

Both Bandit and Cowboy validate UTF-8 of text frames, per spec, but Channels push JSON which are also validated against UTF-8. Therefore, I suggest we use a binary frame for pushing JSON.

Our serializers already handle binary frames, but they always start with the bytes 0, 1, and 2. So there is no clash with JSON and we can start sending JSON over binaries frames without introducing a new serializer version. However, we may want to have a flag on the client that forces it over text instead for those who for some reason need to run against other serializers.

/cc @mtrudel

Dominant language
Elixir
Stars
23.2k
Forks
3.2k
Avg merge
16h 35m
Merged PRs (30d)
18

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from phoenixframework/phoenix

All issues in phoenixframework/phoenix

Similar issues

More Elixir issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.