Azolo

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,

Showing Posts 1 to 10

Azolo

Azolo OP

Currently SSL peers aren’t verified. I tried to figure out how to make it work, but it seems really DIY in the underlying Erlang :ssl module.

If anyone has any advice on how to handle this it would be much appreciated. :smile:

jackalcooper

jackalcooper

Good library. I like the idea to map WS to a process. The WS library I’m using now doesn’t provide process abstraction so I have to implement it every time.

ericTsiliacos

ericTsiliacos

Does your library support reconnect? When the server goes down, we’d like the websocket client to try to reconnect indefinitely.

Azolo

Azolo OP

It does, take a look at the docs for handle_disconnect.

hildersantos

hildersantos

Thanks for sharing this with the community. I was looking for something exactly like this - I’m developing some API clients right now, and one of them needs to connect with a WebSocket. I guess this will help me a lot!

I’ll test it on the coming days.

Thanks again!

Jonathan

Jonathan

Awesome work, Im having some trouble though, how do i send json, im currently trying Client.send_frame(pid, {:text, "{'Page':{'url':'asdf'}}"}) but i get the response `Received Message: {“error”:{“code”:-32700,“message”:“Message must be a valid JSON”}}`` from the connected server.. any help would be appreciated

zambal

zambal

JSON should be double quoted, but I would just use a JSON encoder instead of manually writing it out:

json = %{Page: %{url: "asdf"}} |> Poison.encode!()
Client.send_frame(pid, {:text, json})
Jonathan

Jonathan

thanks! the double quote did the trick, but yeah, probably better to use an encoder..

Azolo

Azolo OP

WebSockex 0.1.3 Released!

The ChangeLog for this release includes:

  • Client.start_link will no longer cause the calling process to exit on
    connection failure and will return a proper error tuple instead.
  • Change WebSockex.Conn.RequestError to WebSockex.RequestError.
  • Add handle_connect_failure to be invoked after initiating a connection
    fails. Fixes #5

Checkout the v0.1.2..v0.1.3 diff for more info.

Azolo

Azolo OP

WebSockex 0.2.0 Released!

This release has some major API changes where callbacks are changed or removed without deprecation.

The affected callbacks are:

  • init/2 - Removed in favor of handle_connect/2.
  • handle_disconnect/2 - The first argument is now a map.
  • handle_connect_failure/2 - Removed with functionality rolled into handle_disconnect/2.

Please don’t be afraid to provide feedback. WebSockex is already meeting my needs, I’d like more information on what needs to change to meet the needs of others. :smile_cat:

The full changelog for this release includes:

Major Changes

  • Moved all the WebSockex.Client module functionality into the base WebSockex module.
  • Roll handle_connect_failure functionality into handle_disconnect.
  • Roll init functionality into handle_connect

Detailed Changes

  • Roll init functionality into handle_connect
    • handle_connect will be invoked upon establishing any connection, i.e., the intial connection and when reconnecting.
    • The init callback is removed entirely.
  • Moved all the WebSockex.Client module functionality into the base WebSockex module.
  • Changed the Application module to WebSockex.Application.
  • Add WebSockex.start for non-linked processes.
  • Add async option to start and start_link.
  • Roll handle_connect_failure functionality into handle_disconnect.
    • The first parameter of handle_disconnect is now a map with the keys: :reason, :conn, and :attempt_number.
    • handle_disconnect now has another return option for when wanted to reconnect with different URI options or headers: {:reconnect, new_conn, new_state}
    • Added the :handle_initial_conn_failure option to the options for start and start_link that will allow handle_disconnect to be called if we can establish a connection during those functions.
    • Removed handle_connect_failure entirely.

Checkout the v0.1.3..v0.2.0 diff for more info.

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
restlessronin
The repo is at GitHub - cyberchitta/openai_ex: Community maintained Elixir library for OpenAI API · GitHub. Docs are at OpenaiEx User Gu...
152 11030 135
New
shahryarjb
The Chelekom project is a library of Phoenix and LiveView components generated via Mix tasks to fit developer needs seamlessly. One of i...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
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

Other Trending Topics Top

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
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
alexslade
Fly’s CEO posted this recently - Turn And Face The Strange · The Fly Blog It says that Fly is going all-in on sprites, which is a worry ...
New
Herve37
We’re evaluating API mocking tools for OpenAPI-based projects and would love to hear what other teams are using. We’re particularly inte...
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
lawik
I was thinking since Goatmire Elixir turned out pretty good I should maybe do another one. 30th of Sep - 2nd of Oct this year./ The firs...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews