Skip to content
This repository has been archived by the owner on Sep 22, 2024. It is now read-only.
/ epl_counter Public archive

Example of Erlang Performance Lab plugin in Elixir

License

Notifications You must be signed in to change notification settings

erlanglab/epl_counter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EPLCounter

Example of erlangpl plugin in Elixir.

Prerequisites

  • Erlang 18.3 and up
  • Elixir 1.4 and up

Walkthrough

First you need to clone this repository and compile the plugin:

$ git clone https://github.com/erlanglab/epl_counter.git
$ cd epl_counter
$ mix compile

Then you need to clone and compile erlangpl, prebuilt packages doesn't have Elixir support yet:

$ git clone https://github.com/erlanglab/erlangpl.git
$ cd erlangpl
$ make rebar
$ make
$ ./bootstrap --with-elixir <path to your local Elixir installation>

Note: path passed to --with-elixir option must be a path to the root of Elixir installation (the one with lib and bin directories)

Start the node which erlangpl will observe:

$ iex --name [email protected]

Now you can start erlangpl:

$ erlangpl -n [email protected] -p /path/to/epl_counter/_build/dev/lib/epl_counter

Head over to your browser, open dev console and type in:

var ws = new WebSocket("ws://localhost:8000/Elixir.EPLCounter.EPL")
ws.onmessage = function(m) { console.log(JSON.parse(m.data).data) }

Around every 5 seconds you should see message being logged, coming from WebSocket connection to plugin, each time the counter should be incremented:

...
{counter: 9}
{counter: 10}
{counter: 11}
...

Releases

No releases published

Packages

No packages published

Languages