Commit 73e2bf3a authored by Jens-Christian Fischer's avatar Jens-Christian Fischer
Browse files

debugging of orientation channel

parent cc2820e0
......@@ -41,7 +41,7 @@ config :logger,
# configuration for the {LoggerFileBackend, :error_log} backend
config :logger, :error_log,
path: "/var/log/grains/error.log",
level: :error
level: :debug
# This line appears further down. Do not forget to uncomment it!
......
......@@ -3,7 +3,7 @@ defmodule Grains.Mixfile do
def project do
[app: :grains,
version: "0.0.14",
version: "0.0.15",
elixir: "~> 1.2",
elixirc_paths: elixirc_paths(Mix.env),
compilers: [:phoenix, :gettext] ++ Mix.compilers,
......
defmodule Grains.OrientationChannel do
use Grains.Web, :channel
require Logger
alias Grains.StatefulMap
alias Grains.ValueView
def join("orientation:" <> _orientation_id, _params, socket) do
Logger.info("joined orientation")
values = StatefulMap.values()
Logger.info(inspect(values))
resp = %{values: Phoenix.View.render_many(values, ValueView, "value.json") }
{:ok, resp, socket}
end
def handle_in("orientation", params, socket) do
Logger.info("orientations #{inspect(params)}")
pitch = params["pitch"]
# roll = params["roll"]
StatefulMap.put("pitch", pitch)
broadcast! socket, "orientation", %{
user: %{id: "anon"},
element: "pitch",
value: pitch
}
{:reply, :ok, socket}
end
end
......@@ -3,6 +3,7 @@ defmodule Grains.UserSocket do
## Channels
channel "slider:*", Grains.SliderChannel
channel "orientation:*", Grains.OrientationChannel
channel "presence:*", Grains.PresenceChannel
......
......@@ -23,9 +23,9 @@ let OrientationPanel = {
this.orientationChannel.join()
.receive("ok", resp => {
resp.values.forEach( (element) => {
this.setSliderValue(element);
} );
// resp.values.forEach( (element) => {
// this.setSliderValue(element);
// } );
})
.receive("error", reason => console.log("join failed", reason));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment