https://github.com/fdbeirao/lolcmonitor
A simple PoC using Elixir and ELM
https://github.com/fdbeirao/lolcmonitor
elixir-lang elm-lang hackaton realtime
Last synced: 7 months ago
JSON representation
A simple PoC using Elixir and ELM
- Host: GitHub
- URL: https://github.com/fdbeirao/lolcmonitor
- Owner: fdbeirao
- Created: 2017-08-10T13:48:20.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-08-10T13:52:06.000Z (over 8 years ago)
- Last Synced: 2025-03-23T11:29:36.650Z (about 1 year ago)
- Topics: elixir-lang, elm-lang, hackaton, realtime
- Language: Elixir
- Size: 56.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# LolcMonitor
This project was used for the Innovation Experience 2017 event on [eVision](http://www.evision-software.com).
## Prerequisites
**Elixir:** http://elixir-lang.org v. 1.4.2, with Erlang OTP 19.0 (64-bit)
**ELM Platform:** http://elm-lang.org v. 0.18
**node.js** https://nodejs.org v. 7.10.0 64bit
**VSCode:** https://code.visualstudio.com
* Extensions:
* elm
* vscode-elixir
**elm-format** `npm install --global elm-format`
**elm-github-install:**
```
npm install --global elm-github-install
```
### First execution (on a Windows machine):
```
mix deps.get
```
(Answer **y** on installing **hex**)
```
mix test
```
(Answer **y** on installing **rebar**)
```
pushd apps\lolc_monitor_web && npm install && pushd web\elm && elm-github-install && rmdir /Q /S elm-stuff\packages\saschatimme\elm-phoenix\0.2.1\example && popd && popd
mix phoenix.server
```
(Allow `erlang` through the firewall)
```
start http://localhost:4000
start http://localhost:4000/v
```
## Running the tests
To run all the tests **once**
```
mix test
```
To run all the tests in **live/watch mode**
```
mix test.watch
```
## Starting the server
```
iex -S mix phoenix.server
```
## Sending a websocket message from the backend to the browser
```
iex> LolcMonitorWeb.Endpoint.broadcast("dashboard:*", "valve_updated", %{ "some": "content" })
```
## Creating a new valve
```
iex> LolcMonitorBackend.add_valve("VLV-1005")
```
## Setting the status of a valve (after adding it)
```
iex> LolcMonitorBackend.set_valve_status("VLV-1010", :normal, :open)
iex> LolcMonitorBackend.set_valve_status("VLV-1010", :normal, :closed)
iex> LolcMonitorBackend.set_valve_status("VLV-1010", :out_of_normal, :open)
iex> LolcMonitorBackend.set_valve_status("VLV-1010", :out_of_normal, :closed)
iex> LolcMonitorBackend.set_valve_status("VLV-1010", :anything, :anything)
```
## Adding dummy valves
```
iex> LolcMonitorBackend.add_dummy_valves(100)
```