jcorrea
Bandit websocket server connection terminated reason={:error, :closed}
Hi everyone! ![]()
I’m building a WebSocket server with Bandit inside a Plug app, and the experience has been fantastic so far, really clear semantics and great performance out of the box.
I’ve run into one issue, though: I occasionally see connections terminate with {:error, :closed}. I’m trying to figure out the best way to diagnose what’s causing these closures, since there’s nothing in the server logs that seems to explain them, and our code never returns a {:stop, reason, state}.
Has anyone dealt with this before or have suggestions on how to track down the source of these disconnects?
Thanks in advance!
Most Liked
krasenyp
If this is deployed somewhere, it might be your infrastructure provider not allowing long-lived connections.
Last Post!
jcorrea
Yes, that definitely makes sense!
Additionally, in my testing I noticed that some WebSocket clients don’t actually send a close frame or status code when they disconnect, they just close the underlying TCP connection. That was a bit surprising and explains why the server sees it as an abrupt disconnect rather than a regular shutdown, which in turn makes it harder to differentiate network interruptions from regular application-level connection terminations.
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #hex
- #security









