duartejc / phoenix-clocks

Displaying current time in almost all timezones with soft-realtime features of Phoenix Framework
4 stars 0 forks source link

Uncaught TypeError: chan.onError is not a function in app.js #2

Open developerworks opened 8 years ago

developerworks commented 8 years ago

I'm using timex 0.19.5 and phoenix 1.0.2

my mix.exs file is:

defmodule Blog.Mixfile do
  use Mix.Project

  def project do
    [app: :blog,
     version: "0.0.1",
     elixir: "~> 1.0",
     elixirc_paths: elixirc_paths(Mix.env),
     compilers: [:phoenix] ++ Mix.compilers,
     build_embedded: Mix.env == :prod,
     start_permanent: Mix.env == :prod,
     deps: deps]
  end

  # Configuration for the OTP application
  #
  # Type `mix help compile.app` for more information
  def application do
    [mod: {Blog, []},
     applications: [:phoenix, :phoenix_html, :cowboy, :logger,
                    :phoenix_ecto, :mariaex, :plug_accesslog, :tzdata]]
  end

  # Specifies which paths to compile per environment
  defp elixirc_paths(:test), do: ["lib", "web", "test/support"]
  defp elixirc_paths(_),     do: ["lib", "web"]

  # Specifies your project dependencies
  #
  # Type `mix help deps` for examples and options
  defp deps do
    [{:phoenix, "~> 1.0.2"},
     {:phoenix_ecto, "~> 1.1"},
     {:mariaex, ">= 0.0.0"},
     {:phoenix_html, "~> 2.1"},
     {:phoenix_live_reload, "~> 1.0", only: :dev},
     {:cowboy, "~> 1.0"},
     {:plug_ribbon, "~> 0.2.0"},
     {:plug_accesslog, "~> 0.9"},
     {:timex, "~> 0.19.5"}]
  enda
end
developerworks commented 8 years ago
import {Socket} from "phoenix"

changed to

import {Socket} from "deps/phoenix/web/static/js/phoenix"
developerworks commented 8 years ago
let socket = new Socket("/ws")

changed to

let socket = new Socket("/socket")
developerworks commented 8 years ago

Uncaught TypeError: socket.join is not a function

var registerClock = function registerClock(tz) {
    // Uncaught TypeError: socket.join is not a function
    socket.join("currenttime:" + tz, {}).receive("ignore", function () {
        return console.log("auth error");
    }).receive("ok", callback).after(10000, function () {
        return console.log("Connection interruption");
    });
};