bunopnu

bunopnu

Hi yall,

I am working on a WebSocket client for some time now, aiming to develop a WebSocket client that’s both simple and reliable.

I’m eagerly looking forward to receiving your feedback! :grinning_face_with_smiling_eyes:

GitHub - bunopnu/fresh: WebSocket client for Elixir, built atop the Mint ecosystem · GitHub

Showing Posts 1 to 7

carterbryden

carterbryden

This is awesome! I’ve been thinking about creating a reverse proxy with Elixir, something like this might make that a lot easier.

bunopnu

bunopnu OP

I typically refrain from bothering forum with releases, but I believe these are noteworthy improvements that should be mentioned :sweat_smile:

v0.4.1 - 29th September 2023

Changed

  • The payload for :reply has been refined to Mint.WebSocket.frame() | [Mint.WebSocket.frame()], meaning it can now be either a single WebSocket frame or a list of WebSocket frames.

v0.4.0 - 23rd September 2023

Added

  • Exponential backoff strategy for reconnection attempts.
  • :hibernate_after Option to automatically hibernate the WebSocket connection process after a specified duration of inactivity, helping conserve system resources.

Changed

  • Enhanced documentation for a more user-friendly experience.
anuaralfetahe

anuaralfetahe

Hi, thanks for the library!

I’m having some trouble starting the websocket connection.

defmodule Mymodule.Protocol.Websocket do
  use Fresh

  def start_link() do
    __MODULE__.start_link(
      uri: "wss://ws.kraken.com",
      state: %{},
      opts: [
        name: {:local, :consumer_1}
      ]
    )
  end
end

and this is the response I receive:

{:ok, #PID<0.229.0>}
** (EXIT from #PID<0.228.0>) shell process exited with reason: an exception was raised:
    ** (FunctionClauseError) no function clause matching in Mint.HTTP1.request/5
        (mint 1.5.1) lib/mint/http1.ex:251: Mint.HTTP1.request(%Mint.HTTP1{host: "ws.kraken.com", port: 443, request: nil, streaming_request: nil, socket: {:sslsocket, {:gen_tcp, #Port<0.7>, :tls_connection, :undefined}, [#PID<0.238.0>, #PID<0.237.0>]}, transport: Mint.Core.Transport.SSL, mode: :active, scheme_as_string: "https", requests: {[], []}, state: :open, buffer: "", proxy_headers: [], private: %{scheme: :wss, extensions: [], sec_websocket_key: "BjILFTs2jHw7qAt9C6CftQ=="}, log: false}, "GET", nil, [{"upgrade", "websocket"}, {"connection", "upgrade"}, {"sec-websocket-version", "13"}, {"sec-websocket-key", "BjILFTs2jHw7qAt9C6CftQ=="}], nil)
        (fresh 0.4.2) lib/fresh/connection.ex:92: Fresh.Connection.disconnected/3
        (stdlib 5.1.1) gen_statem.erl:1377: :gen_statem.loop_state_callback/11
        (stdlib 5.1.1) proc_lib.erl:241: :proc_lib.init_p_do_apply/3

As I can see it actually starts the process but dies immediately after.
I’m using Elixir 1.15.5.

bunopnu

bunopnu OP

I found the bug.

It is because of a missing path, adding a “/” at the end of the URI solves the issue, it will be fixed in next release :slight_smile:

(sorry for late response, I was busy with my school)

jimsynz

jimsynz

Ash Core Team

I’m also working on a reverse proxy that uses bandit and mint. Keen to compare notes.

bunopnu

bunopnu OP

v0.4.3 - 26th October 2023

Fixed

  • Failing to connect when no path is given in URI.

v0.4.2 - 12th October 2023

Added

  • New open?/1 function, which allows you to check whether a connection is open.
mruoss

mruoss

Does fresh offer connection pooling? E.g. like Finch for plain HTTP?

— All posts loaded —

Where Next? Top

Trending in Announcing Top

type1fool
WebAuthnLiveComponent WebAuthnComponents See this post about renaming the package. Passwordless authentication for Phoenix LiveView app...
New
GenericJam
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
woylie
I released Doggo, a collection of unstyled Phoenix components. https://github.com/woylie/doggo Features Unstyled Phoenix components....
New
JesseHerrick
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
ahamez
Hi everyone, I’ve been working on this protobuf library for 3 years. We use it in the company I work for, EasyMile, to communicate with ...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
kip
I’ll shortly be launching Text, a nascent text analysis library. Current functionality In this early version (not ready for prime time) ...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
budgie
A little off-topic, but I feel like people here have a good head on their shoulders. I used to be quite good at making software. Was luc...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New
bartblast
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
budgie
I love Elixir. It’s one of 2 programming languages I’ve ever fallen in love with. But I don’t use it anymore. Serverless was the promis...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews