Azolo
Hey everyone,
I just released WebSockex which is a Elixir WebSocket client.
WebSockex strives to work as a OTP special process, be RFC6455 compliant, and be simple to use by providing smart defaults for common actions.
Take a look and let me know about any questions, suggestions, or any other comments you may have,
Trending in Announcing
Flop is an Elixir library that applies filtering, ordering and pagination parameters to your Ecto queries.
offset-based pagination with...
New
I needed to reuse React components from my Chrome extension in my Phoenix/LiveView backend. I noticed that for Svelte/Vue, there are live...
New
I released Doggo, a collection of unstyled Phoenix components.
https://github.com/woylie/doggo
Features
Unstyled Phoenix components....
New
Edit: 2026 May 15 - This post is archived.
Mob is alive!!
Main docs: mob v0.7.11 — Documentation
A bit of explanation for the slightly c...
New
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Hello
Published a new library - ProcessHub!
ProcessHub is a library designed to manage process distribution within the Elixir cluster. ...
New
Other Trending Topics
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hi everyone!
The first release candidate for the Expert language server project is now available!
We’ve published a press release detai...
New
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself.
My main conc...
New
This showed up on my feed.. anyone heard of it? Just hype?
Ox Alpha is a reasoning model designed for coding, sustained ag...
New
Hey folks,
I just published a post about Hologram’s funding and where the project goes next - the short version:
Curiosum as Main Spons...
New
:microphone: ElixirConf 2026 - Call for Talks is open!
We’re heading to Chicago :united_states:
:round_pushpin: In person + virtual
:d...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #ai
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #elixirconf-eu
- #metaprogramming
- #hex










Showing Posts 53 to 44- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
LostKobrakai
Check the conditions required for terminate to be called.
marschro
Hi all,
I try to understand something.
I have a iot device (shelly switch) that I am connected to via stateful websockex.
When I just disconnect the shelly from the power grid, so that it immediately stops and the socket connection stops, then according to the docs terminate is invoked on our side (the side that created the socket connection)
I have those two callbacks:
… but I never get a log when terminating the socket connection by pulling the plug.
So is this expected behavior or am I doing something wrong. I would be happy to find a way, when a client disconnects or more in my case, terminates the socket connection.
Any hint appreciated.
cheers,
Martin
anuaralfetahe
Stumbled on the same problems.
So basically I created a GenServer which is wrapper for the WebSockex process.
Starting the GenServer will return the pid no matter if the WebSockex fails on the start_link or not. You actualy start the websocket connection in the handle_continue/2 func asynchrously.
Then you need to specify
handle_initial_conn_failure: trueoption on the WebSockex start_link func so you can handle the error in the handle_disconnect/2 func. In the handle_disconnect/2 func you can return the tuple{:reconnect, state}for automatic reconnecting. I have added some process sleep there aswell. Here’s the code:Theres also an option called
asyncon the WebSocex library but this does not seem to work with the sending frame or I am missing something.AlchemistCamp
I’ve implemented a terminate very similar to that one. It gets executed if I cut the web connection after connecting but not if the connection is off when
start_link()is called. In both cases, this leads to taking down the whole process and its supervisors.The behavior I want instead is to just keep trying to reconnect to the 3rd party endpoint periodically.
Exadra37
Maybe you need to implement
terminate/2?AlchemistCamp
This is probably a basic question, but I’ve been having some problems getting modules where I use
WebSockexto not crash their supervisors when there’s an issue connecting (e.g. when I turn my wifi off).Here’s my start_link:
With my wifi off,
iex -S mixwill crash with:I’ve implemented a
handle_disconnect/2. What changes should I make so that a networking failure doesn’t crash the whole module (and its supervisors)?fcw528
Cannot use proxy. When will proxy option be added?
ragamuf
Thumbs up for sharing this work. I’m using it to integrate with Slack RTM.
Azolo
WebSockex 0.4.1 Released!
Enhancements
:viaand:globaltuples for named registration.cast/2andsend_frame/2.handle_connect/2viaConn.resp_headers.Conn.parse_url/1to handle url to URI conversion.Conn.new/2to use a url string instead of aURIstruct.child_specdefinitions for Elixir 1.5+Supervisor.child_spec/2Bug Fixes
handle_disconnectif there is reason to exit from invoking a callback. (e.g. an exception was raised)send_frame/2in a callback.Take a look at the
v0.4.0...v0.4.1diff or the release onhex.pmfor more information.Azolo
Section 5.6 of the WebSocket Spec says that all complete
textdata frames need to be valid UTF8. However, closer reading of Section 8.1 implies that you could get away with sending a non-validtextframe and it is on the receiver to verify.I think for the sake of this being a library and such, it should just work with as many use cases as possible instead of being the most correct version possible. So I am more than willing to forego the outgoing check in favor of making it work for your use case. Especially since the spec implies I can do that.
But there are probably a couple of non-trivial changes to make for
iodata. Unless I don’t care about the overall send/write performance and just set it as a binary before it was sent, which would defeat the point ofiodata.