jswanner

jswanner

ReqWebSocket - Req plugin adding WebSocket support

I’ve release ReqWebSocket, a Req plugin for establishing WebSocket connections, using Mint.WebSocket.

resp =
  Req.new(connect_options: [protocols: [:http1]], into: :self)
  |> ReqWebSocket.attach()
  |> Req.get!(url: "wss://echo.websocket.org/")

{:ok, resp, [text: _text]} = ReqWebSocket.parse_message(resp, receive do m -> m end)
{:ok, resp} = ReqWebSocket.send_frame(resp, :ping)
{:ok, resp, [pong: ""]} = ReqWebSocket.parse_message(resp, receive do m -> m end)

The main benefits I see with using a Req plugin for making WebSocket requests have to do with being able to use Req’s request, response, and error steps for things like settings headers, following redirects, and performing retries. In addition to that, this library adds some conveniences regarding decoding & encoding WebSocket frames.

https://github.com/jswanner/req_web_socket

Where Next?

Popular in Announcing Top

zorbash
I created Kitto a framework for dashboards inspired by Dashing. The distributed characteristics of Elixir and the low memory footprint...
New
danschultzer
In short Plug n’ play OAuth 2.0 provider library. Just set up a resource owner schema with Ecto (your user schema), install the dependen...
New
josevalim
Yes, yet another parser combinator library! Most of the parser combinators in the ecosystem are either compile-time, often using AST tra...
159 19834 141
New
bryanjos
Hi, I wanted share a small library we at Revelry Labs made for rendering react components from the server side. There are instructions fo...
New
tmbb
I’ve been working on two packages (not on hex.pm yet) to build admin interfaces for phoenix apps: bureaucrat - which contains a bunch ...
New
kip
Image is an image processing library for Elixir. It is based upon the fabulous vix library that provides a libvips wrapper for Elixir. I...
622 19460 194
New
brainlid
LangChain is short for Language Chain. An LLM, or Large Language Model, is the “Language” part. This library makes it easier for Elixir a...
New

Other popular topics Top

baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
hariharasudhan94
Lets say I have map like this fetching from my database %{"_id" => #BSON.ObjectId<58eb1a7a9ad169198c3dXXXX>, "email" => ...
New
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1144 54921 245
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New

We're in Beta

About us Mission Statement