/elm-phoenix-websocket

An Elm 0.19.x package for working with Phoenix WebSockets

Primary LanguageElmBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

Elm 0.19.x package for Phoenix WebSockets

A very simple to use Package that provides your Elm program access to the PhoenixJS API.

In order for your Elm program to talk to PhoenixJS, you will need to add a JavaScript file to your Phoenix project and a very small Port module to your Elm src files.

Set up JavaScript

The JS file you need, and set up instructions are here.

Set up the Ports

The Port module you need, and set up instructions are here.

Install the package

elm install phollyer/elm-phoenix-websocket

Examples

A Phoenix application that provides an Elm SPA with a dozen examples can be found here.

The relevant Elm files for the examples are here.

A live version of the example application is running here.

Further Reading

Package docs.

For more information about Phoenix WebSockets see Phoenix.Channel , Phoenix.Presence and PhoenixJS.

Roadmap

  • Add pushSequence function. I would like to add the ability to provide a list of pushes that will be actioned in sequence. This will need to handle some decision making based on if a push succeeds, errors, or results in a timeout. I will be looking into this as soon as I am able to find the time. Pull requests are welcome.