- Install dependencies with
mix deps.get - Create and migrate your database with
mix ecto.create && mix ecto.migrate - Install Node.js dependencies with
npm install - Start Phoenix endpoint with
iex -S mix phoenix.server
Now you can visit localhost:4000 from your browser.
To be used in conjunction with CoapDirectory and CoapNode. It's described in the blogposts below.
Demo:
- Start a CoapDirectory and add a resource via CoapNode as described in those repositories
- Visit your Phoenix app in the browser
- Open the browser console
- Start an observation of a resource by typing its path in the input box, e.g. "switches/2"
- If the CoapDirectory is running and such resource has been registered, clicking the "Observe!" button will start an observation. From now on you will see the updates to this resource logged in the console.
- Try changing the resource's state by making a PUT request toggling the resource:
iex(4)> CoapWebserver.ResourceClient.put("switches/2", "toggle")(see the blogposts for details). - Check the console - you should be asynchronously informed of the update to the resource.