https://github.com/queer/singyeong-client-elixir
Elixir client for 신경
https://github.com/queer/singyeong-client-elixir
Last synced: about 1 year ago
JSON representation
Elixir client for 신경
- Host: GitHub
- URL: https://github.com/queer/singyeong-client-elixir
- Owner: queer
- Created: 2020-11-15T01:01:37.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-05-26T06:15:17.000Z (about 5 years ago)
- Last Synced: 2025-03-10T14:55:43.594Z (over 1 year ago)
- Language: Elixir
- Size: 111 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# singyeong-client
A pure Elixir client for 신경.
## Installation
[Get it on Hex.](https://hex.pm/packages/singyeong)
```elixir
def deps do
[
{:singyeong, "~> 0.1.1"}
]
end
```
## Usage
1. Add children to your application's supervisor:
```Elixir
# The actual client that connects and sends/receives messages
{Singyeong.Client, Singyeong.parse_dsn("singyeong://my_app_name:my_password@localhost:4567")},
# Event producer
Singyeong.Producer,
# Your event consumer
MyApp.Consumer,
```
2. Create a consumer:
```Elixir
defmodule MyApp.Consumer do
use Singyeong.Consumer
def start_link do
Consumer.start_link __MODULE__
end
def handle_event(event) do
IO.inspect event, pretty: true
:ok
end
end
```
3. That's it! Start running your application whenever you want.