Created
December 5, 2018 11:22
-
-
Save olivermt/170926237bf7eccffae80e30ba049723 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def join("room:" <> room_id, _params, socket) do | |
#this prints | |
IO.inspect(room_id) | |
case RoomCtx.find(room_id) do | |
nil -> | |
#does not print | |
IO.inspect("not found") | |
Logger.debug("[channel:room] attempted to join nonexistent room #{room_id}") | |
{:error, :not_found} | |
room -> | |
#does not print | |
IO.inspect("found room") | |
room = Repo.preload(room, :subscriptions) | |
do_join(socket, room, is_subscribed?(room, socket)) | |
end | |
|> post_join() | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def find(id) when is_binary(id) do | |
#this prints just fine | |
IO.inspect("Getting id #{id}") | |
Repo.get(Room, id) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment