# \#channel

**URL:** https://forum.elixirforum.com/tag/channel/796.md

[Latest](https://forum.elixirforum.com/latest.md) · [Categories](https://forum.elixirforum.com/categories.md) · [Tags](https://forum.elixirforum.com/tags.md)

---

## [How to enable compression for LiveView diffs](https://forum.elixirforum.com/t/how-to-enable-compression-for-liveview-diffs/34027)

<div class="topic-metadata">

**Author:** [@clemensm](https://forum.elixirforum.com/u/clemensm)\
**Replies:** 5\
**Last updated:** [May 11, 2025, 2:53pm UTC](https://forum.elixirforum.com/t/how-to-enable-compression-for-liveview-diffs/34027 "2025-05-11T14:53:46Z")

</div>

Hi everyone I’m currently developing an app using Phoenix LiveView, and we’ve got one component (search) where we’ve got to push rather large chanes over the wire (html up to ca. 700kB). When I was checking on how we c…

---

## [Reconnection when close code is 1000](https://forum.elixirforum.com/t/reconnection-when-close-code-is-1000/68312)

<div class="topic-metadata">

**Author:** [@satoren](https://forum.elixirforum.com/u/satoren)\
**Replies:** 3\
**Last updated:** [February 7, 2025, 5:27pm UTC](https://forum.elixirforum.com/t/reconnection-when-close-code-is-1000/68312 "2025-02-07T17:27:06Z")

</div>

Currently, the Phoenix Channel client does not reconnect when the close code is 1000. Based on the tests, this seems to be the intended behavior. Why is that the case? Also, if we want to enable reconnection even in thi…

---

## [Is it possible to add a custom channel to the liveview socket?](https://forum.elixirforum.com/t/is-it-possible-to-add-a-custom-channel-to-the-liveview-socket/39825)

<div class="topic-metadata">

**Author:** [@derek-zhou](https://forum.elixirforum.com/u/derek-zhou)\
**Replies:** 1\
**Last updated:** [November 7, 2023, 1:03am UTC](https://forum.elixirforum.com/t/is-it-possible-to-add-a-custom-channel-to-the-liveview-socket/39825 "2023-11-07T01:03:44Z")

</div>

LiveView by default use the /live socket. A user socket by default use the /socket socket. A socket is further divided into channels that don’t interfere with each other. Can I reuse the live socket and just add a few ch…

---

## [How do I assert the state (assigns) of a socket in a Channel?](https://forum.elixirforum.com/t/how-do-i-assert-the-state-assigns-of-a-socket-in-a-channel/57928)

<div class="topic-metadata">

**Author:** [@Pistrie](https://forum.elixirforum.com/u/Pistrie)\
**Replies:** 1\
**Last updated:** [August 29, 2023, 1:42pm UTC](https://forum.elixirforum.com/t/how-do-i-assert-the-state-assigns-of-a-socket-in-a-channel/57928 "2023-08-29T13:42:07Z")

</div>

Using the ChannelCase I can assert that certain events are happening, and that I receive certain replies from the server. However, I haven’t found a way to assert changes to the socket.assigns. I alter the state to keep …

---

## [Sharing a channel between clients (LiveView + Mobile apps)](https://forum.elixirforum.com/t/sharing-a-channel-between-clients-liveview-mobile-apps/57855)

<div class="topic-metadata">

**Author:** [@te\_chris](https://forum.elixirforum.com/u/te_chris)\
**Replies:** 6\
**Last updated:** [August 25, 2023, 10:50am UTC](https://forum.elixirforum.com/t/sharing-a-channel-between-clients-liveview-mobile-apps/57855 "2023-08-25T10:50:07Z")

</div>

Hey everyone. I’m working on a service that’s currently LV but will eventually have an app. The interaction will basically be the same. This has had me thinking about how I could avoid duplication with client/server inte…

---

## [Pushing data from LiveView to Channel over PubSub?](https://forum.elixirforum.com/t/pushing-data-from-liveview-to-channel-over-pubsub/56692)

<div class="topic-metadata">

**Author:** [@regex.sh](https://forum.elixirforum.com/u/regex.sh)\
**Replies:** 2\
**Last updated:** [June 25, 2023, 10:56pm UTC](https://forum.elixirforum.com/t/pushing-data-from-liveview-to-channel-over-pubsub/56692 "2023-06-25T22:56:03Z")

</div>

I have a Channel on which the JavaScript front-end connects. I have a LiveView UI from which the user can type messages and send them to JS UI (well, it can’t, which is the problem here). My flow is as follows: JS use…

---

## [What is the simplest way to create a first-in, first-out queue to handle binary data that will be consumed from an external process? ](https://forum.elixirforum.com/t/what-is-the-simplest-way-to-create-a-first-in-first-out-queue-to-handle-binary-data-that-will-be-consumed-from-an-external-process/55763)

<div class="topic-metadata">

**Author:** [@Trini](https://forum.elixirforum.com/u/Trini)\
**Replies:** 5\
**Last updated:** [May 9, 2023, 12:25am UTC](https://forum.elixirforum.com/t/what-is-the-simplest-way-to-create-a-first-in-first-out-queue-to-handle-binary-data-that-will-be-consumed-from-an-external-process/55763 "2023-05-09T00:25:04Z")

</div>

what happens is that i am receiving binary data in my (speech recognition) application, but after some time, heap overflow occurs. I thought my memory wasn’t being freed, but that wasn’t the problem… what I think is happ…

---

## [Is phoenix channel can be use to microsecond stopwatch?](https://forum.elixirforum.com/t/is-phoenix-channel-can-be-use-to-microsecond-stopwatch/55702)

<div class="topic-metadata">

**Author:** [@huntz20](https://forum.elixirforum.com/u/huntz20)\
**Replies:** 6\
**Last updated:** [May 8, 2023, 12:26am UTC](https://forum.elixirforum.com/t/is-phoenix-channel-can-be-use-to-microsecond-stopwatch/55702 "2023-05-08T00:26:41Z")

</div>

Hi guys here the thing i want to make scoring board with web that can see real time by everyone, but in my scoring board i do have stopwatch with microsecond precision is it possible to use channel on this approach ? an…

---

## [Connecting to Channel from within application](https://forum.elixirforum.com/t/connecting-to-channel-from-within-application/37133)

<div class="topic-metadata">

**Author:** [@AlejandroHuerta](https://forum.elixirforum.com/u/AlejandroHuerta)\
**Replies:** 9\
**Last updated:** [March 15, 2023, 11:45am UTC](https://forum.elixirforum.com/t/connecting-to-channel-from-within-application/37133 "2023-03-15T11:45:51Z")

</div>

Hey everyone, here’s my use case: I have a channel that sends events to a GenServer running a simulation and that GenServer responds, as well as sends broadcast back to the channel. Now I want to create another GenServer…

---

## [Alternative to StatsD or how to do Application Event Tracking](https://forum.elixirforum.com/t/alternative-to-statsd-or-how-to-do-application-event-tracking/52842)

<div class="topic-metadata">

**Author:** [@derpycoder](https://forum.elixirforum.com/u/derpycoder)\
**Replies:** 2\
**Last updated:** [December 30, 2022, 10:58am UTC](https://forum.elixirforum.com/t/alternative-to-statsd-or-how-to-do-application-event-tracking/52842 "2022-12-30T10:58:28Z")

</div>

Hey Guys, What’s the alternative to StatsD? I saw that it can be used to record statistics, like channel join or whatever comes to mind. However, since it’s written in Nodejs, I don’t want to use it. I thought adding …

---

## [How to test broadcast inside terminate/2?](https://forum.elixirforum.com/t/how-to-test-broadcast-inside-terminate-2/51126)

<div class="topic-metadata">

**Author:** [@Aetherus](https://forum.elixirforum.com/u/Aetherus)\
**Replies:** 5\
**Last updated:** [October 18, 2022, 10:42am UTC](https://forum.elixirforum.com/t/how-to-test-broadcast-inside-terminate-2/51126 "2022-10-18T10:42:52Z")

</div>

For some reason, I want to broadcast a message when someone leaves a channel or disconnects due to some network issues. I wrote this code: defmodule MyAppWeb.SomeChannel do use MyAppWeb, :channel @impl true def …

---

## [Phoenix Channel sometimes stop working because :handle\_info function is no longer exported](https://forum.elixirforum.com/t/phoenix-channel-sometimes-stop-working-because-handle-info-function-is-no-longer-exported/50787)

<div class="topic-metadata">

**Author:** [@clemensm](https://forum.elixirforum.com/u/clemensm)\
**Replies:** 3\
**Last updated:** [October 7, 2022, 9:21am UTC](https://forum.elixirforum.com/t/phoenix-channel-sometimes-stop-working-because-handle-info-function-is-no-longer-exported/50787 "2022-10-07T09:21:57Z")

</div>

Hi there I’ve run into a really strange problem in one of my apps recently, which I sadly cannot reproduce reliably but do see from time to time in :dev and :prod environments. So I’ve got an app where users can create…

---

## [Is there a maximum number of possible or advised PubSub/channel subscriptions?](https://forum.elixirforum.com/t/is-there-a-maximum-number-of-possible-or-advised-pubsub-channel-subscriptions/50322)

<div class="topic-metadata">

**Author:** [@elt547](https://forum.elixirforum.com/u/elt547)\
**Replies:** 3\
**Last updated:** [September 18, 2022, 6:08pm UTC](https://forum.elixirforum.com/t/is-there-a-maximum-number-of-possible-or-advised-pubsub-channel-subscriptions/50322 "2022-09-18T18:08:48Z")

</div>

What’s a reasonable upper limit for subscriptions per client in phoenix? Not sure what the capabilities are. What is the typical first symptom that you’ll notice if you are opening too many connections?

---

## [Phoenix Channel - question on broadcast behavior on cluster](https://forum.elixirforum.com/t/phoenix-channel-question-on-broadcast-behavior-on-cluster/48625)

<div class="topic-metadata">

**Author:** [@januarvs](https://forum.elixirforum.com/u/januarvs)\
**Replies:** 4\
**Last updated:** [June 30, 2022, 2:45am UTC](https://forum.elixirforum.com/t/phoenix-channel-question-on-broadcast-behavior-on-cluster/48625 "2022-06-30T02:45:45Z")

</div>

Hi, I am learning about Phoenix Channel and have question on behavior of broadcast which not as I expected. Environment: Windows 10, Phoenix 1.4.17, Erlang 22, Elixir 1.12 Nodes: server@127.0.01, listening on port 40…

---

## [Error about no socket supervision tree in tests](https://forum.elixirforum.com/t/error-about-no-socket-supervision-tree-in-tests/47480)

<div class="topic-metadata">

**Author:** [@patreeceeo](https://forum.elixirforum.com/u/patreeceeo)\
**Replies:** 6\
**Last updated:** [April 29, 2022, 12:51am UTC](https://forum.elixirforum.com/t/error-about-no-socket-supervision-tree-in-tests/47480 "2022-04-29T00:51:09Z")

</div>

Hi, I’m trying to write a test for a channel and am confused by the way the test is failing. My test: defmodule MusicJamServerWeb.RoomChannelTest do use MusicJamServerWeb.ChannelCase setup do {:ok, \_, socket} …

---

## [Ranch listener MyApp.Endpoint.HTTP had connection process started with :cowboy\_clear:start\_link/4 at ... exit with reason](https://forum.elixirforum.com/t/ranch-listener-myapp-endpoint-http-had-connection-process-started-with-start-link-4-at-exit-with-reason/47454)

<div class="topic-metadata">

**Author:** [@patreeceeo](https://forum.elixirforum.com/u/patreeceeo)\
**Replies:** 9\
**Last updated:** [April 28, 2022, 12:23am UTC](https://forum.elixirforum.com/t/ranch-listener-myapp-endpoint-http-had-connection-process-started-with-start-link-4-at-exit-with-reason/47454 "2022-04-28T00:23:33Z")

</div>

My phoenix app starts up fine, but as soon as I modify any elixir source files the above error begins to occur repeatedly. This is the reason it gives: {:undef, \[{MusicJamGameWeb.RoomChannel, :child\_spec, \[{MusicJamGame…

---

## [Shape of Phoenix Channel socket messages](https://forum.elixirforum.com/t/shape-of-phoenix-channel-socket-messages/45632)

<div class="topic-metadata">

**Author:** [@gpreston](https://forum.elixirforum.com/u/gpreston)\
**Replies:** 3\
**Last updated:** [January 29, 2022, 6:09pm UTC](https://forum.elixirforum.com/t/shape-of-phoenix-channel-socket-messages/45632 "2022-01-29T18:09:26Z")

</div>

Hello, I’m wondering what the first 2 indices of the arrays sent/received over Phoenix socket connections are. Here are some examples from my Network tab in the browser dev tools: (send) \["3","3","room:36","phx\_join…

---

## [Weird bug with phoenix channels app](https://forum.elixirforum.com/t/weird-bug-with-phoenix-channels-app/45554)

<div class="topic-metadata">

**Author:** [@KevinDaSilvaS](https://forum.elixirforum.com/u/KevinDaSilvaS)\
**Replies:** 0\
**Last updated:** [January 26, 2022, 11:34pm UTC](https://forum.elixirforum.com/t/weird-bug-with-phoenix-channels-app/45554 "2022-01-26T23:34:47Z")

</div>

So I’m creating a notificator project that gets a message from a rabbitmq queue connects to a certain topic in phoenix, and pushes the message to the server to be broadcasted But if my app for some reason is down when t…

---

## [Phoenix Sockets getting stuck at "closed", "connecting" or "disconnecting" state](https://forum.elixirforum.com/t/phoenix-sockets-getting-stuck-at-closed-connecting-or-disconnecting-state/44761)

<div class="topic-metadata">

**Author:** [@hubertlepicki](https://forum.elixirforum.com/u/hubertlepicki)\
**Replies:** 2\
**Last updated:** [January 3, 2022, 12:51pm UTC](https://forum.elixirforum.com/t/phoenix-sockets-getting-stuck-at-closed-connecting-or-disconnecting-state/44761 "2022-01-03T12:51:19Z")

</div>

I am using Phoenix with Apollo and @absinthe/socket-apollo-link to listen to GraphQL subscriptions. The users spend a lot of time on the app with tab open, without refreshing the page, often they have the app open for we…

---

## [UserSocket CONNECT is spammed](https://forum.elixirforum.com/t/usersocket-connect-is-spammed/42431)

<div class="topic-metadata">

**Author:** [@askasp](https://forum.elixirforum.com/u/askasp)\
**Replies:** 1\
**Last updated:** [September 23, 2021, 8:05am UTC](https://forum.elixirforum.com/t/usersocket-connect-is-spammed/42431 "2021-09-23T08:05:24Z")

</div>

Hi, im struggling a bit with what seems to be a socke connection spam, and I’m unsure if im doing anything wrong, or is this just a normal reconnect cycle? I have a user socket that each user connects to. This socket ha…

---

## [Camelizing channel payloads](https://forum.elixirforum.com/t/camelizing-channel-payloads/41988)

<div class="topic-metadata">

**Author:** [@icecap](https://forum.elixirforum.com/u/icecap)\
**Replies:** 2\
**Last updated:** [August 30, 2021, 7:19pm UTC](https://forum.elixirforum.com/t/camelizing-channel-payloads/41988 "2021-08-30T19:19:44Z")

</div>

I need to camelize channel payloads for js purposes I have tried 2 options so far, 1- writing a custom serializer and 2- wrapping Jason and passing it to json\_library in config In both cases, presence diffs and fields …

---

## [Connecting to a channel for chat app](https://forum.elixirforum.com/t/connecting-to-a-channel-for-chat-app/40911)

<div class="topic-metadata">

**Author:** [@odipus](https://forum.elixirforum.com/u/odipus)\
**Replies:** 1\
**Last updated:** [July 8, 2021, 6:03am UTC](https://forum.elixirforum.com/t/connecting-to-a-channel-for-chat-app/40911 "2021-07-08T06:03:46Z")

</div>

In the web I found tons of tutorial for chat app but i could nt find any for my specific case. Lets say I have a list of friends and if any of them personally msg me I will see it in real time. The tutorial I was talkin…

---

## [Type mismatch for @callback handle\_in/3 in Phoenix.Channel behaviour](https://forum.elixirforum.com/t/type-mismatch-for-callback-handle-in-3-in-phoenix-channel-behaviour/40391)

<div class="topic-metadata">

**Author:** [@jhefreyzz](https://forum.elixirforum.com/u/jhefreyzz)\
**Replies:** 2\
**Last updated:** [June 12, 2021, 10:38am UTC](https://forum.elixirforum.com/t/type-mismatch-for-callback-handle-in-3-in-phoenix-channel-behaviour/40391 "2021-06-12T10:38:04Z")

</div>

Try learning again Phoenix channels and stumbled upon a dialyzer warning I can’t seem to solve. My whole channel code below. @impl true def join("room:lobby", payload, socket) do send(self(), :after\_join) …

---

## [Multiplayer Bot Architecture for Phoenix App?](https://forum.elixirforum.com/t/multiplayer-bot-architecture-for-phoenix-app/40168)

<div class="topic-metadata">

**Author:** [@henrysdev](https://forum.elixirforum.com/u/henrysdev)\
**Replies:** 5\
**Last updated:** [June 1, 2021, 3:19pm UTC](https://forum.elixirforum.com/t/multiplayer-bot-architecture-for-phoenix-app/40168 "2021-06-01T15:19:22Z")

</div>

I have a multiplayer web game that uses Phoenix Channels for communication with clients via websockets. I’d like to add server-side bot players to my game. I’ve given some thought on where in the stack to add the bots. …

---

## [Can we have Phoenix Channels for a cowboy2 websocket handlers](https://forum.elixirforum.com/t/can-we-have-phoenix-channels-for-a-cowboy2-websocket-handlers/38737)

<div class="topic-metadata">

**Author:** [@VBandarupalli](https://forum.elixirforum.com/u/VBandarupalli)\
**Replies:** 2\
**Last updated:** [April 7, 2021, 4:42am UTC](https://forum.elixirforum.com/t/can-we-have-phoenix-channels-for-a-cowboy2-websocket-handlers/38737 "2021-04-07T04:42:43Z")

</div>

Is it possible to have a channel for a websocket created using cowboy2. I have two sockets in my application. One of the websocket is using cowboy2. I am not able to create the channel for the websocket. My websocket …

---

## [Channels (topics/subtopics) conventions (naming, code structure)](https://forum.elixirforum.com/t/channels-topics-subtopics-conventions-naming-code-structure/37660)

<div class="topic-metadata">

**Author:** [@TheMaikXX](https://forum.elixirforum.com/u/TheMaikXX)\
**Replies:** 4\
**Last updated:** [February 19, 2021, 2:28pm UTC](https://forum.elixirforum.com/t/channels-topics-subtopics-conventions-naming-code-structure/37660 "2021-02-19T14:28:43Z")

</div>

(Note: hypothetical code examples below are in context of example chatting app) (Note: I’m also beginner, so I apologize for any misunderstanding in the upcoming text) Hello, I’d like to ask how should I construct my …

---

## [How to best implement play with random palyers](https://forum.elixirforum.com/t/how-to-best-implement-play-with-random-palyers/36627)

<div class="topic-metadata">

**Author:** [@tanweerdev](https://forum.elixirforum.com/u/tanweerdev)\
**Replies:** 1\
**Last updated:** [January 4, 2021, 3:51pm UTC](https://forum.elixirforum.com/t/how-to-best-implement-play-with-random-palyers/36627 "2021-01-04T15:51:08Z")

</div>

I have a scenario where one user would like to play game with someone random online. Here are basic requirements select one random user send a request to that user via channel if user doesnt respond within 10 seconds,…

---

## [Phoenix.js Channel Presence onJoin firing multiple times](https://forum.elixirforum.com/t/phoenix-js-channel-presence-onjoin-firing-multiple-times/31790)

<div class="topic-metadata">

**Author:** [@celsobonutti](https://forum.elixirforum.com/u/celsobonutti)\
**Replies:** 3\
**Last updated:** [December 31, 2020, 9:10am UTC](https://forum.elixirforum.com/t/phoenix-js-channel-presence-onjoin-firing-multiple-times/31790 "2020-12-31T09:10:46Z")

</div>

I’m trying to use a Phoenix Channel for the signaling part of a WebRTC application, as I thought Presence would be perfect for this. The thing is: I’m trying to track a user join using Phoenix.js’ Presence object, like …

---

## [Basic questions of creating a real time api for mobile developer](https://forum.elixirforum.com/t/basic-questions-of-creating-a-real-time-api-for-mobile-developer/35336)

<div class="topic-metadata">

**Author:** [@shahryarjb](https://forum.elixirforum.com/u/shahryarjb)\
**Replies:** 5\
**Last updated:** [November 6, 2020, 10:29am UTC](https://forum.elixirforum.com/t/basic-questions-of-creating-a-real-time-api-for-mobile-developer/35336 "2020-11-06T10:29:08Z")

</div>

Hello, I have read this page, and some video which wanted to create a real time chat in a web page with Phoenix channel help. But I never realized some things that are very basic and important. question one: when I just…

---

## [How can I serialize a schema(or list of schema) from database?](https://forum.elixirforum.com/t/how-can-i-serialize-a-schema-or-list-of-schema-from-database/35311)

<div class="topic-metadata">

**Author:** [@freewebwithme](https://forum.elixirforum.com/u/freewebwithme)\
**Replies:** 3\
**Last updated:** [November 3, 2020, 4:11am UTC](https://forum.elixirforum.com/t/how-can-i-serialize-a-schema-or-list-of-schema-from-database/35311 "2020-11-03T04:11:55Z")

</div>

I am trying to send a cart information when a user join the channel. But having some trouble serializing a cart information. in my cart\_channel.ex def join("cart:" \<\> user\_id, \_params, %{assigns: %{current\_user: user}}…

[Next page](https://forum.elixirforum.com/tag/channel/796.md?match_all_tags=true&page=1&tags%5B%5D=channel)
