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

wojtekmach
Hey everyone! Req is an HTTP client for Elixir that I’ve been working on for quite some time. There is already a lot of HTTP clients out...
New
handnot2
Samly can be used to enable SAML 2.0 Single Sign On in a Plug/Phoenix application. This library uses Erlang esaml to provide plug enabl...
New
woylie
Flop is an Elixir library that applies filtering, ordering and pagination parameters to your Ecto queries. offset-based pagination 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
marciok
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
fuelen
Hi all! I want to present a small library which provides a mix task for generating an Entity-Relationship Diagram for Ecto schemas. You...
New
anuaralfetahe
Hello Published a new library - ProcessHub! ProcessHub is a library designed to manage process distribution within the Elixir cluster. ...
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
mudasobwa
I am seeing a lot of aplications of Argumentum ad Vericundiam in software discussions. They do link some piece of writing and point us to...
New
AstonJ
This showed up on my feed.. anyone heard of it? Just hype? Ox Alpha is a reasoning model designed for coding, sustained ag...
New
sergio
It’s not that it’s vocabulary is too advanced. It’s something worse. I get lost trying to follow even a paragraph written by Claude. It’...
New
sorenone
Today we’re releasing Oban for Python. Not an Oban client in Python. Not a pythonx wrapper embedded in Elixir. Nope, it’s a fully operati...
New
akoutmos
@hugobarauna, Dr. Dimitrios Koutmos (my brother) and I (Alex Koutmos) have been hard at work on writing a book on how you can use Elixir ...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews