TL;DR
We created Elm ports and some Javascript code to connect to the WebSocket server using Elm in the previous post. Let’s use Elm ports to start to listen to WebSocket messages and send Picshare messages in the opposite direction This post is part of the functional language series, and it is based on a remarkable book, Programming Elm Build Safe and Maintainable Front-End Applications by Jeremy Fairbank.
Let’s use Elm ports to start to listen to WebSocket messages and send Picshare messages in the opposite direction. Follow comment instructions from the gist:
In a previous post, I made an error in index.html
. Javascript code was not in the scope of the init
function:
Build the Picshare:
elm make Picshare.elm --output picshare.js
Success! Compiled 1 module.
Picshare ───> picshare.js
and open index.html
and in Chrome, open the Javascript console that should look like the above screenshot.