Skip to content

Instantly share code, notes, and snippets.

@benjamintanweihao
Created October 5, 2014 09:36
Show Gist options
  • Select an option

  • Save benjamintanweihao/0adfb3ccef4c2790efe1 to your computer and use it in GitHub Desktop.

Select an option

Save benjamintanweihao/0adfb3ccef4c2790efe1 to your computer and use it in GitHub Desktop.
defmodule Wiky.ParserChannel do
use Phoenix.Channel
def join(socket, "start-parser", message) do
Wiky.Parser.start_link("/Users/benjamintan/Downloads/wiki.xml")
Enum.map 1..100, fn _ ->
reply socket, "join", Wiky.Parser.Agent.get_state
end
{:ok, socket}
end
def join(socket, _no, _message) do
{:error, socket, :unauthorized}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment