Websocket client in Erlang
Asked Answered
C

3

9

I'd like to try to start using Erlang, and there's a data feed i'd like to read that's distributed via Websockets. Right now i'm doing the same in node.js using the 'websocket-client' module, but could someone suggest a websocket client library for Erlang that I could look at? (Or an alternative solution if I'm off the mark)

Caplin answered 16/6, 2011 at 15:15 Comment(8)
misultin is an erlang web server and seems to have websocket support.Cryptoclastic
@Jonas Oh I misread it. Here's oneCryptoclastic
yaws too has something to do with web sockets. The only problem is that the implementation could be older than the newer specification on web socketsPregnancy
@Muzaaya: Again, Yaws is not a client.Lectern
Any reason you are skipping socket.io? It will gracefully fall back on browsers that are not supporting websockets. There is also an Erlang implementation of the backend in the works.Reginiaregiomontanus
@CRAP ANSWERS - I'm looking for a server-side client, not a serverCaplin
Oh, I see. Not very often you find Erlang as a client of those things :)Reginiaregiomontanus
I was looking for one as well, to test the websocket server implementationIngather
I
3

here you are: https://github.com/MiCHiLU/erlang_websocket

you may consider also gun: https://github.com/extend/gun

Irresolvable answered 22/6, 2011 at 16:42 Comment(0)
U
3

Here is a promising one: https://github.com/jeremyong/websocket_client

This one didn't exist at the time the question was asked, but it's a good question that deserves to be updated.

Unpeopled answered 9/9, 2013 at 19:6 Comment(3)
Thanks for the plug. I wrote this one so I could test my server websocket code in Erlang. The biggest things other clients were missing was wss support (https protocol), and continuation frames.Katzir
@Katzir I was trying to use your websocket client against a cowboy websocket server but with no success. So the ws_ping_example.erl that you gave uses a websocket_client:cast(self(), Msg) to send a message to remote server but I cant use the same function anywhere else in the ping example code. also, is the handler only to receive messages from the remote server or can that handler also send data over websocket? Can you please throw some light ? thanks a lot.Inequality
@Katzir Can you post a very simple example as to how we can send data to remote server. I see that you use websocket_client:cast/2 but cant seem to use that else except the init/2 callback of the websocket_client_handler behavior. Thanks!Inequality
K
0

ninenines/gun seems to be the most up-to-date according to the GitHub repository page.

Here is the documentation guide on how to use it with WebSockets: https://ninenines.eu/docs/en/gun/2.0/guide/websocket/

Kidderminster answered 6/10, 2023 at 13:4 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.