Skip to content
Permalink
Browse files
Add the chatroom
  • Loading branch information
CrowdHailer committed May 28, 2018
1 parent 4cb1eff commit af92dba
Showing 1 changed file with 16 additions and 0 deletions.
@@ -1,2 +1,18 @@
defmodule Watercooler do
@group :watercooler

def publish(message) do
:ok = :pg2.create(@group)
for client <- :pg2.get_members(@group) do
send(client, {@group, message})
end

{:ok, message}
end

def listen() do
:ok = :pg2.create(@group)
:ok = :pg2.join(@group, self())
{:ok, @group}
end
end

0 comments on commit af92dba

Please sign in to comment.