<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/the-problem-of-reconnects-in-phoenix-liveview-rxfnxoe8z" -->

---
title: The Problem of Reconnects in Phoenix LiveView | daily.dev
description: Phoenix LiveView's WebSocket-based model loses all server-side state (assigns) when a connection drops — a common occurrence in elevators, tab switches, Wi-Fi...
canonical: https://daily.dev/posts/the-problem-of-reconnects-in-phoenix-liveview-rxfnxoe8z
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: The Problem of Reconnects in Phoenix LiveView | daily.dev
og:description: Phoenix LiveView's WebSocket-based model loses all server-side state (assigns) when a connection drops — a common occurrence in elevators, tab switches, Wi-Fi...
og:url: https://daily.dev/posts/the-problem-of-reconnects-in-phoenix-liveview-rxfnxoe8z
og:image: https://api.daily.dev/og/posts/RxFnXOE8z.png
og:image:alt: The Problem of Reconnects in Phoenix LiveView
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# The Problem of Reconnects in Phoenix LiveView

**[Software Mansion](https://daily.dev/sources/swmansion)** · 7 min read · 0 upvotes · 0 comments

## Summary

Phoenix LiveView's WebSocket-based model loses all server-side state (assigns) when a connection drops — a common occurrence in elevators, tab switches, Wi-Fi hiccups, and server redeploys. Standard mitigations include client-side JS state, form auto-recovery, and URL query params, but these don't cover all scenarios. LiveStash is a new Elixir library that adds a simple API (stash_assigns/2 and recover_state/1) to persist assigns across reconnects. It offers two adapters: an ETS-based server-side store that keeps state on the server with only a reference sent to the client, and a Browser Memory adapter that serializes state to a JS variable so it survives full server redeploys. The post compares the trade-offs between the two strategies and positions LiveStash as a complement to, not a replacement for, standard LiveView practices.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://swmansion.com/blog/the-problem-of-reconnects-in-phoenix-live-view>

## Similar posts on daily.dev

- [ElixirConf EU](https://daily.dev/posts/elixirconf-eu-3zacb8kop) · ElixirStatus · 0 upvotes · 0 comments
- [How to simulate LiveView socket reconnection](https://daily.dev/posts/how-to-simulate-liveview-socket-reconnection-tyrg72zcf) · Elixir Forum · 0 upvotes · 0 comments
- [Phoenix LiveView widgets with hooks: a reusable pattern](https://daily.dev/posts/phoenix-liveview-widgets-with-hooks-a-reusable-pattern-ldf39mbva) · Curiosum · 0 upvotes · 0 comments
- [Exploring LiveView 1.2](https://daily.dev/posts/exploring-liveview-1-2-p8vjxpn4x) · Elixir Forum · 0 upvotes · 0 comments
- [WebSockets vs. SSE should be about ordering and correctness](https://daily.dev/posts/websockets-vs-sse-should-be-about-ordering-and-correctness-anliqz3yb) · Dashbit · 2 upvotes · 2 comments

---

Tags: [#elixir](https://daily.dev/tags/elixir), [#websocket](https://daily.dev/tags/websocket), [#liveview](https://daily.dev/tags/liveview)

[View this post on daily.dev](https://daily.dev/posts/the-problem-of-reconnects-in-phoenix-liveview-rxfnxoe8z)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"The Problem of Reconnects in Phoenix LiveView","url":"https://daily.dev/posts/the-problem-of-reconnects-in-phoenix-liveview-rxfnxoe8z","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/the-problem-of-reconnects-in-phoenix-liveview-rxfnxoe8z"},"datePublished":"2026-08-02T07:15:36.247Z","dateModified":"2026-08-02T07:39:48.997Z","description":"Phoenix LiveView's WebSocket-based model loses all server-side state (assigns) when a connection drops — a common occurrence in elevators, tab switches, Wi-Fi...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/de97327112ec6a155faca0f7995b7079?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/de97327112ec6a155faca0f7995b7079?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Software Mansion","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Software Mansion","logo":"https://media.daily.dev/image/upload/s--sOx0vaVZ--/f_auto,q_auto/v1785654908/logos/swmansion?_a=BAMAMicg0","url":"https://daily.dev/sources/swmansion"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/the-problem-of-reconnects-in-phoenix-liveview-rxfnxoe8z","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"elixir,websocket,liveview","timeRequired":"PT7M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Software Mansion","item":"https://daily.dev/sources/swmansion"},{"@type":"ListItem","position":3,"name":"The Problem of Reconnects in Phoenix LiveView"}]}
```

