pragdave/wex — pull request #3 by MSch (2014-08-15 18:22:28+00:00)
Title: Supervision tree.

My attempt at #2

![2014-08-15 at 20 11](https://cloud.githubusercontent.com/assets/7475/3936981/3a3bd228-24a8-11e4-935d-4dec477c47b3.png)

I start `Wex.Dispatcher` and rely on its local registration as `:dispatcher` (that should probably become `Wex.Dispatcher`, `:dispatcher` is too generic IMO) to find it in the `:websocket_handler`

Instead of using `:cowboy.start_http` I use `:ranch.child_spec` which returns a child spec I can supply to my supervisor as child.

I went with `:one_for_one` for the application supervisor, because I think if the dispatcher crashes and gets restarted we don't need to close open websocket connections, since they'll just work with the new dispatcher? (I haven't gotten it to actually run, didn't find /scripts/ours/... so couldn't test)