https://github.com/ejscunha/gen_websocket
https://github.com/ejscunha/gen_websocket
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/ejscunha/gen_websocket
- Owner: ejscunha
- License: mit
- Created: 2019-04-15T10:24:05.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2021-04-11T15:31:49.000Z (about 4 years ago)
- Last Synced: 2023-10-17T10:58:43.029Z (over 1 year ago)
- Language: Elixir
- Size: 11.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# GenWebsocket
A websocket client based on [gun](https://github.com/ninenines/gun) with a similar API to [gen_tcp](http://erlang.org/doc/man/gen_tcp.html).
## Installation
The package can be installed by adding `gen_websocket` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
{:gen_websocket, "~> 0.1.0"}
]
end
```## Usage
Below is a small example on how you can start a client and use it to send and receive data, and how to stop the client. See the full docs at https://hexdocs.pm/gen_websocket for more information.
```elixir
{:ok, client} = GenWebsocket.connect('echo.websocket.org', 80)
:ok = GenWebsocket.send(client, "data")
{:ok, "data"} = GenWebsocket.recv(client, 0)
:ok = GenWebsocket.close(client)
```## Contributing
Contributions are welcome! Feel free to open an issue if you'd like to discuss a problem or a possible solution. Pull requests are much appreciated.