Giter Site home page Giter Site logo

wsecli's Introduction

wsecli

A WebSocket client written in Erlang

This project was born as a side project while I'm doing my end of dregree project. What this means is:

  • I don't have too much time to include new features.

But,

  • I'll try to fix any bugs.
  • I'll try to finish anything on the TODO.
  • If anyone suggests something interesting/cool, I'll try to include it : )

Features

Supported protocol versions

Currently only the version specificied at RFC6455 (version 13) is supported.

Please notice that currently, neither subprotocols nor extensions are currently available.

Build ###

Add this repo as a dependency to your rebar.config file and then

rebar compile

Usage ###

I will demostrate its usage with the echo service at www.websocket.org.

Start it,

1>wsecli:start("echo.websocket.org", 80, "/").

Add a callback for received messages,

2>wsecli:on_message(fun(text, Message)-> io:format("Echoed message: ~s ~n", [Message]) end).

Send a message that will be echoed,

3> wsecli:send("Hello").
ok
Echoed message: Hello

And finally to stop it

4>wsecli:stop().

Callbacks

Callbacks for the events: on_open, on_error, on_message and on_close can be added. Check the code or the documentation for details.

Tests

Unit tests

Unit test where done with the library espec by lucaspiller.

To run them

rake spec

or, in case you don't have rake installed,

rebar compile && ERL_LIBS='deps/' ./espec test/spec/

TODO

  • Accept WebSocket uris (those with ws:// format).
  • Support streaming (not sure how to do this).
  • Support ssl.
  • Creation on multiple clients (too lazy, that's why I haven't done it already)

License

Licensed under Apache 2.0. Check LICENSE for details

Contribute

If you find or think that something isn't working properly, just open an issue.

Pull requests and patches (with tests) are welcome.

wsecli's People

Contributors

madtrick avatar

Watchers

Konrad Wyrozumski avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.