RexJS is library for reactivity between elixir data with front-end through javascript websockets.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
config
docs
lib
test
.gitignore
.travis.yml
LICENSE.md
README.md
mix.exs
mix.lock

README.md

RexJS - elixir

Inline docs Travis

RexJS is library for reactivity between elixir data and front-end through javascript websockets.

Installation

Elixir

Add rexjs to your list of dependencies in mix.exs:

def deps do
  [{:rexjs, "~> 0.1.0"}]
end

Front-end

Usage

Phoenix Framework:

Add to config.ex:

config :rexjsphoenix, YourPhoenixApp.Endpoint,
  ...
  http: [dispatch: [
        {:_, [
            {"/rexjs", Orisons.RexJS.Adapter.Cowboy, []},
            {:_, Plug.Adapters.Cowboy.Handler, {YourPhoenixApp.Endpoint, []}}
          ]}]]

Cowboy:

:cowboy_router.compile([
  { :_,
    [
      {"/rexjs", Orisons.RexJS.Adapter.Cowboy, []}
      {"/someurl", DynamicPageHandler, []},
    ]
  }
])

You can change "/rexjs" endpoint to other, it's configurable in front-end.

Start worker

  Orisons.RexJS.Module.start_worker("worker_unique_name")

Set module data in worker

  Orisons.RexJS.Module.set_data("worker_unique_name", "module_name", "Some value")

This function post message with data to all binded websockets with this worker and module

More info you can find in documentation.