# \#socket

**URL:** https://forum.elixirforum.com/tag/socket/413.md

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

---

## [Kernel TLS offload for Elixir](https://forum.elixirforum.com/t/kernel-tls-offload-for-elixir/73778)

<div class="topic-metadata">

**Author:** [@ausimian](https://forum.elixirforum.com/u/ausimian)\
**Replies:** 5\
**Last updated:** [December 27, 2025, 4:15am UTC](https://forum.elixirforum.com/t/kernel-tls-offload-for-elixir/73778 "2025-12-27T04:15:28Z")

</div>

I was curious whether it would be possible to use kernel TLS offload from Elixir. I have a preference for the non-blocking socket programming model over :gen\_tcp (probably due to the brain damage I incurred by writing ma…

---

## [Tips on understanding Phoenix Presence?](https://forum.elixirforum.com/t/tips-on-understanding-phoenix-presence/52462)

<div class="topic-metadata">

**Author:** [@kasvith](https://forum.elixirforum.com/u/kasvith)\
**Replies:** 4\
**Last updated:** [August 9, 2025, 4:25pm UTC](https://forum.elixirforum.com/t/tips-on-understanding-phoenix-presence/52462 "2025-08-09T16:25:02Z")

</div>

i dont understand how phoenix presence works in the examples defmodule MyAppWeb.MyChannel do use MyAppWeb, :channel alias MyAppWeb.Presence def join("some:topic", \_params, socket) do send(self(), :after\_join…

---

## [Button inside form reloads the entire view](https://forum.elixirforum.com/t/button-inside-form-reloads-the-entire-view/62310)

<div class="topic-metadata">

**Author:** [@DestroyedSoul](https://forum.elixirforum.com/u/DestroyedSoul)\
**Replies:** 4\
**Last updated:** [July 22, 2025, 10:20am UTC](https://forum.elixirforum.com/t/button-inside-form-reloads-the-entire-view/62310 "2025-07-22T10:20:28Z")

</div>

Hello, I have a page that consists of several user inputs and buttons. For real-time validation (as well as updating character count) I am using form, but only phx-change, no phx-submit. My page structure looks roughl…

---

## [How to use Phoenix \`socket\` on localhost with React Frontend?](https://forum.elixirforum.com/t/how-to-use-phoenix-socket-on-localhost-with-react-frontend/71468)

<div class="topic-metadata">

**Author:** [@vipulbhj](https://forum.elixirforum.com/u/vipulbhj)\
**Replies:** 7\
**Last updated:** [July 8, 2025, 3:33pm UTC](https://forum.elixirforum.com/t/how-to-use-phoenix-socket-on-localhost-with-react-frontend/71468 "2025-07-08T15:33:56Z")

</div>

Hello, I am trying to build a Backend system in Phoenix, this is mostly APIs but needs Websockets for a chat interface. I researched a bit with Claude, and found out that Phoenix sockets can be a great choice for this w…

---

## [How to mock phoenix sockets in Jest?](https://forum.elixirforum.com/t/how-to-mock-phoenix-sockets-in-jest/68775)

<div class="topic-metadata">

**Author:** [@skyqrose](https://forum.elixirforum.com/u/skyqrose)\
**Replies:** 1\
**Last updated:** [March 27, 2025, 7:54pm UTC](https://forum.elixirforum.com/t/how-to-mock-phoenix-sockets-in-jest/68775 "2025-03-27T19:54:15Z")

</div>

I want to test my js app that uses phoenix.js sockets. I want to write tests along the lines of: Set up a mocked socket and channel. Render my app. Interact with the app. Assert that a message was sent on the channel. M…

---

## [Feature request: Reply to socket connect](https://forum.elixirforum.com/t/feature-request-reply-to-socket-connect/68694)

<div class="topic-metadata">

**Author:** [@skyqrose](https://forum.elixirforum.com/u/skyqrose)\
**Replies:** 3\
**Last updated:** [March 4, 2025, 3:19pm UTC](https://forum.elixirforum.com/t/feature-request-reply-to-socket-connect/68694 "2025-03-04T15:19:53Z")

</div>

Proposal: I wish the socket connect/3 callback could allow returning a reply to the frontend, which would then be visible in phoenix.js as an argument to the callback given to socket.onOpen. I think this would be strai…

---

## [Is it practical to make a Minecraft server backend with Elixir?](https://forum.elixirforum.com/t/is-it-practical-to-make-a-minecraft-server-backend-with-elixir/68583)

<div class="topic-metadata">

**Author:** [@MatinDevs](https://forum.elixirforum.com/u/MatinDevs)\
**Replies:** 4\
**Last updated:** [January 17, 2025, 5:05pm UTC](https://forum.elixirforum.com/t/is-it-practical-to-make-a-minecraft-server-backend-with-elixir/68583 "2025-01-17T17:05:01Z")

</div>

I understand that this is theoretically possible. One could utilize NIFs along with Rust or another language for CPU-intensive tasks, such as world generation. My question is: Can we leverage Elixir’s unique advantages …

---

## [Listening to Heartbeat & Disconnections without Channels & Presence](https://forum.elixirforum.com/t/listening-to-heartbeat-disconnections-without-channels-presence/68788)

<div class="topic-metadata">

**Author:** [@krishna\_vaguelyright](https://forum.elixirforum.com/u/krishna_vaguelyright)\
**Replies:** 0\
**Last updated:** [January 17, 2025, 7:18am UTC](https://forum.elixirforum.com/t/listening-to-heartbeat-disconnections-without-channels-presence/68788 "2025-01-17T07:18:34Z")

</div>

Hi! I am trying to see if I can listen to heartbeat & disconnect events without having to use user channels & presence I am seeing if I can avoid creating user channels if the socket is given the proper user-id. P…

---

## [Storing transient data for chat sessions](https://forum.elixirforum.com/t/storing-transient-data-for-chat-sessions/67851)

<div class="topic-metadata">

**Author:** [@acrolink](https://forum.elixirforum.com/u/acrolink)\
**Replies:** 5\
**Last updated:** [December 4, 2024, 5:53pm UTC](https://forum.elixirforum.com/t/storing-transient-data-for-chat-sessions/67851 "2024-12-04T17:53:05Z")

</div>

For an AI driven chatbot over channels I want to store some transient data. There will be 10’s of thousands of concurrent users. Will be hosted on AWS using either EB, ECR or EKS, i.e. using multiple machines/pods. What …

---

## [Using Phoenix socket / LiveView in a horizontally scaled application](https://forum.elixirforum.com/t/using-phoenix-socket-liveview-in-a-horizontally-scaled-application/67064)

<div class="topic-metadata">

**Author:** [@acrolink](https://forum.elixirforum.com/u/acrolink)\
**Replies:** 8\
**Last updated:** [November 1, 2024, 1:53pm UTC](https://forum.elixirforum.com/t/using-phoenix-socket-liveview-in-a-horizontally-scaled-application/67064 "2024-11-01T13:53:33Z")

</div>

Hi, I am developing a chat-bot using Phoenix and LiveView. My question, as the application gets more users, I will have to scale it up by adding more machines (using Kubernetes, AWS Elastic Beanstalk, AWS ECS etc). Woul…

---

## [liveSocket.disconnect() unexpected behavior with longpoll](https://forum.elixirforum.com/t/livesocket-disconnect-unexpected-behavior-with-longpoll/65402)

<div class="topic-metadata">

**Author:** [@rhcarvalho](https://forum.elixirforum.com/u/rhcarvalho)\
**Replies:** 1\
**Last updated:** [August 8, 2024, 7:39pm UTC](https://forum.elixirforum.com/t/livesocket-disconnect-unexpected-behavior-with-longpoll/65402 "2024-08-08T19:39:29Z")

</div>

Hi! Today I noticed that when a LiveSocket goes into longpoll fallback mode, calling liveSocket.disconnect() on the browser console behaves different than when the LiveSocket is connected over a WebSocket. liveSocket.d…

---

## [Websockets Not Working: Phoenix Scripts On Sub-Domain, Loaded Through Main Domain / Apache](https://forum.elixirforum.com/t/websockets-not-working-phoenix-scripts-on-sub-domain-loaded-through-main-domain-apache/41871)

<div class="topic-metadata">

**Author:** [@peppy](https://forum.elixirforum.com/u/peppy)\
**Replies:** 4\
**Last updated:** [May 16, 2024, 9:34pm UTC](https://forum.elixirforum.com/t/websockets-not-working-phoenix-scripts-on-sub-domain-loaded-through-main-domain-apache/41871 "2024-05-16T21:34:50Z")

</div>

My Apache setup is like this: ## MAIN WEBSITE ## \<VirtualHost \*:443\> ServerAdmin admin@mywebsite.com ServerName www.mywebsite.com ServerAlias mywebsite.com DocumentRoot /home/username/mywebsite.com ProxyRequ…

---

## [How to terminate sockets from a channel topic in the Phoenix server side?](https://forum.elixirforum.com/t/how-to-terminate-sockets-from-a-channel-topic-in-the-phoenix-server-side/61724)

<div class="topic-metadata">

**Author:** [@JoshLearningElixir](https://forum.elixirforum.com/u/JoshLearningElixir)\
**Replies:** 1\
**Last updated:** [February 18, 2024, 10:32am UTC](https://forum.elixirforum.com/t/how-to-terminate-sockets-from-a-channel-topic-in-the-phoenix-server-side/61724 "2024-02-18T10:32:56Z")

</div>

Suppose a room is public, everyone can join. However if the admin of the room sets the room to private, only a certain number of people can remain in the room; everyone else will be kicked out of the room. How to kick p…

---

## [Phoenix LiveView - App responds slow in Production environment every ~20 seconds](https://forum.elixirforum.com/t/phoenix-liveview-app-responds-slow-in-production-environment-every-20-seconds/60284)

<div class="topic-metadata">

**Author:** [@marschro](https://forum.elixirforum.com/u/marschro)\
**Replies:** 12\
**Last updated:** [December 15, 2023, 11:04pm UTC](https://forum.elixirforum.com/t/phoenix-liveview-app-responds-slow-in-production-environment-every-20-seconds/60284 "2023-12-15T23:04:42Z")

</div>

Hello all, I am currently experiencing some strange behavior on my production environment. I run a Phoenix LiveView App Server is FreeBSD with haproxy upfront The behavior If you navigate the liveView app via navig…

---

## [How to access http headers in Phoenix socket?](https://forum.elixirforum.com/t/how-to-access-http-headers-in-phoenix-socket/32186)

<div class="topic-metadata">

**Author:** [@gsmlg](https://forum.elixirforum.com/u/gsmlg)\
**Replies:** 35\
**Last updated:** [December 1, 2023, 5:03pm UTC](https://forum.elixirforum.com/t/how-to-access-http-headers-in-phoenix-socket/32186 "2023-12-01T17:03:55Z")

</div>

Can not get http header info from a Phoenix socket. %Phoenix.Socket{ assigns: %{}, channel: nil, channel\_pid: nil, endpoint: Web.Endpoint, handler: Web.UserSocket, id: nil, join\_ref: nil, joined: false, …

---

## [:gen\_tcp.recv() take long time to return](https://forum.elixirforum.com/t/gen-tcp-recv-take-long-time-to-return/58587)

<div class="topic-metadata">

**Author:** [@danubiolima](https://forum.elixirforum.com/u/danubiolima)\
**Replies:** 5\
**Last updated:** [November 30, 2023, 8:00pm UTC](https://forum.elixirforum.com/t/gen-tcp-recv-take-long-time-to-return/58587 "2023-11-30T20:00:53Z")

</div>

Hi! I’m trying implement a HTTP client using erlang library :gen\_tcp and the section of code that should recover packet from socket are take too long time to return. My function is: def request(url) do %{host: hos…

---

## [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 …

---

## [Socket resets when trying to render/mount LiveComponent](https://forum.elixirforum.com/t/socket-resets-when-trying-to-render-mount-livecomponent/57580)

<div class="topic-metadata">

**Author:** [@ukashazia](https://forum.elixirforum.com/u/ukashazia)\
**Replies:** 4\
**Last updated:** [August 12, 2023, 12:06pm UTC](https://forum.elixirforum.com/t/socket-resets-when-trying-to-render-mount-livecomponent/57580 "2023-08-12T12:06:06Z")

</div>

I’m facing an issue where the socket appears to get reset ( no data persisted ) when i try to navigate to parent with LiveComponent. the mount/1 of component should receive socket from push\_patch but there’s no data in …

---

## [Returning Socket.connect/2 error to phoenix.js](https://forum.elixirforum.com/t/returning-socket-connect-2-error-to-phoenix-js/57449)

<div class="topic-metadata">

**Author:** [@icecap](https://forum.elixirforum.com/u/icecap)\
**Replies:** 0\
**Last updated:** [August 4, 2023, 11:26pm UTC](https://forum.elixirforum.com/t/returning-socket-connect-2-error-to-phoenix-js/57449 "2023-08-04T23:26:10Z")

</div>

Hi everyone Just updated phoenix.js to latest where the .onError signature seems to have changed Previously, I was just getting the status code as a string. Now I’m getting an object with shape { isTrusted: false, …

---

## [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…

---

## [Phoenix.Socket and connection origin](https://forum.elixirforum.com/t/phoenix-socket-and-connection-origin/56678)

<div class="topic-metadata">

**Author:** [@regex.sh](https://forum.elixirforum.com/u/regex.sh)\
**Replies:** 3\
**Last updated:** [June 24, 2023, 8:36pm UTC](https://forum.elixirforum.com/t/phoenix-socket-and-connection-origin/56678 "2023-06-24T20:36:39Z")

</div>

Hi, I have a question about Sockets/Channels but couldn’t find an answer (sorry if duplicate) I’m trying to check the origin of the socket connection. I want to limit who can use a specific channel based on their URL ad…

---

## [Is UDP socket in the active mode anit-pattern?](https://forum.elixirforum.com/t/is-udp-socket-in-the-active-mode-anit-pattern/55986)

<div class="topic-metadata">

**Author:** [@mickel8](https://forum.elixirforum.com/u/mickel8)\
**Replies:** 2\
**Last updated:** [May 21, 2023, 7:28am UTC](https://forum.elixirforum.com/t/is-udp-socket-in-the-active-mode-anit-pattern/55986 "2023-05-21T07:28:32Z")

</div>

Hi, do you have any experience in using UDP sockets in the active mode? On the one hand, having a socket in the passive mode, you won’t overwhelm your application as you read as fast as you can. On the other hand, if you…

---

## [Is it possible to replicate the net::ERR\_CONNECTION\_RESET error at the client-side when making an API call or using a WebSocket?](https://forum.elixirforum.com/t/is-it-possible-to-replicate-the-net-err-connection-reset-error-at-the-client-side-when-making-an-api-call-or-using-a-websocket/54714)

<div class="topic-metadata">

**Author:** [@aungmyooo2k17](https://forum.elixirforum.com/u/aungmyooo2k17)\
**Replies:** 2\
**Last updated:** [March 30, 2023, 3:38am UTC](https://forum.elixirforum.com/t/is-it-possible-to-replicate-the-net-err-connection-reset-error-at-the-client-side-when-making-an-api-call-or-using-a-websocket/54714 "2023-03-30T03:38:38Z")

</div>

I developed a live view application using Elixir, specifically a Phoenix application, and have been running it in the browser for an extended period of time. Occasionally, I encounter an error, such as net::ERR\_CONNECTIO…

---

## [Got assign/3 expects a socket error on assign/2 or assign/3 when trying to update assigns in function](https://forum.elixirforum.com/t/got-assign-3-expects-a-socket-error-on-assign-2-or-assign-3-when-trying-to-update-assigns-in-function/54723)

<div class="topic-metadata">

**Author:** [@eddyraz](https://forum.elixirforum.com/u/eddyraz)\
**Replies:** 9\
**Last updated:** [March 22, 2023, 1:23am UTC](https://forum.elixirforum.com/t/got-assign-3-expects-a-socket-error-on-assign-2-or-assign-3-when-trying-to-update-assigns-in-function/54723 "2023-03-22T01:23:05Z")

</div>

good Morning, I have a function that place a request to an elasticsearch REST API of a library management software, and I am trying to manipulate the response so I get the results(so far all OK), and the total results qu…

---

## [Request: LiveView Timer Example](https://forum.elixirforum.com/t/request-liveview-timer-example/53194)

<div class="topic-metadata">

**Author:** [@r4z4](https://forum.elixirforum.com/u/r4z4)\
**Replies:** 12\
**Last updated:** [January 16, 2023, 7:13pm UTC](https://forum.elixirforum.com/t/request-liveview-timer-example/53194 "2023-01-16T19:13:04Z")

</div>

Hello I am struggling to implement a simple timer in LiveView, and so I was wondering if anyone knew of any good examples out there that I could take a look at? I just want to display a simple countdown timer on the pag…

---

## [Broadcast to another live view and handle message](https://forum.elixirforum.com/t/broadcast-to-another-live-view-and-handle-message/52879)

<div class="topic-metadata">

**Author:** [@RuslanMykulyn](https://forum.elixirforum.com/u/RuslanMykulyn)\
**Replies:** 8\
**Last updated:** [January 2, 2023, 5:31pm UTC](https://forum.elixirforum.com/t/broadcast-to-another-live-view-and-handle-message/52879 "2023-01-02T17:31:32Z")

</div>

Hello gents, I’m trying to refresh my Elixir/Phoenix knowledge after some time. Currently I’m struggling a couple of days with this issue. I have a live view structure to handle list-detail UI such as this: # router …

---

## [Interleaving writes on a TCP connection: are they atomic?](https://forum.elixirforum.com/t/interleaving-writes-on-a-tcp-connection-are-they-atomic/52614)

<div class="topic-metadata">

**Author:** [@bortzmeyer](https://forum.elixirforum.com/u/bortzmeyer)\
**Replies:** 1\
**Last updated:** [December 18, 2022, 4:16pm UTC](https://forum.elixirforum.com/t/interleaving-writes-on-a-tcp-connection-are-they-atomic/52614 "2022-12-18T16:16:24Z")

</div>

I have a TCP/IP server writing responses to a connected socket. (I use Socket.Stream.send, it may be different with raw :gen\_tcp?) Several Elixir processes run in parallel writing to the same socket. Is there a guarante…

---

## [Tracking online/offline activity of a subset of users](https://forum.elixirforum.com/t/tracking-online-offline-activity-of-a-subset-of-users/52378)

<div class="topic-metadata">

**Author:** [@kasvith](https://forum.elixirforum.com/u/kasvith)\
**Replies:** 0\
**Last updated:** [December 9, 2022, 10:10am UTC](https://forum.elixirforum.com/t/tracking-online-offline-activity-of-a-subset-of-users/52378 "2022-12-09T10:10:51Z")

</div>

Hi, what’s the best way to track the online/offline activity of a subset of users with a Phx? In my example, I have a product listing page where I know user IDs as they appear with search/pagination now I want to subscr…

---

## [Testing Phoenix channels: How to test changes to the socket assigns done in handle\_in/3 and get the updated socket?](https://forum.elixirforum.com/t/testing-phoenix-channels-how-to-test-changes-to-the-socket-assigns-done-in-handle-in-3-and-get-the-updated-socket/51296)

<div class="topic-metadata">

**Author:** [@SZJX](https://forum.elixirforum.com/u/SZJX)\
**Replies:** 7\
**Last updated:** [October 24, 2022, 12:43pm UTC](https://forum.elixirforum.com/t/testing-phoenix-channels-how-to-test-changes-to-the-socket-assigns-done-in-handle-in-3-and-get-the-updated-socket/51296 "2022-10-24T12:43:09Z")

</div>

I might be approaching this in the wrong way. I have a handle\_in/3 call that would change the socket assigns. I see that Phoenix.ChannelTest provides a push function. However, the problem is that this function seems to o…

---

## [How i can get socket data by the data i assigned to it](https://forum.elixirforum.com/t/how-i-can-get-socket-data-by-the-data-i-assigned-to-it/31967)

<div class="topic-metadata">

**Author:** [@skokon](https://forum.elixirforum.com/u/skokon)\
**Replies:** 5\
**Last updated:** [October 20, 2022, 3:25pm UTC](https://forum.elixirforum.com/t/how-i-can-get-socket-data-by-the-data-i-assigned-to-it/31967 "2022-10-20T15:25:23Z")

</div>

Hello Elixir community, I’m new to elixir and phoenix, I’m trying to get the socket by the data I already assigned to it for example, I’ve set the user-id socket = assign(socket, :user\_id, USER\_ID) Now I want to get t…

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