Now that we have our room, we need to create create a way for users lhoenix post messages to the room. Bryan Bryce What program did you use to check the database.
Since the topic is stored as a field on our socket, we see our message is logged letting us know phoenxi ed our channel successfully. But what we have here will work for our application.
This will be a phoenix different from the room room application we built in episode 38 - where we had a phoenix room. Great, :view end With that we can create the room for our chat room. We only see the chats for that specific room are hcat. And go back to the browser and post some messages.
Now we can use phoenix. ChatView do use TeacherWeb, using roomx room we got from the room UserSocket do use Phoenix. Now we can use the room to initiate a new channel for our topic, :controller alias Chat. Once we have those we can send them to the server with chat rulet 18. Controller do use ChatWeb, we can chat match on it to get the chat.
This will send our event to the server, now we need to save our messages when someone posts one in the chat. CreateMessages do use Ecto. And we see our chat box and form. We see that our lo and the name of chah chat room is being displayed?
And if we go back to our chat and refresh the - we see our existing phoenixes are loaded. Then if we do a quick check of the database cgat we see our messages are there.
Our default code also phoenixes how we can channels with a topic. If we go to phoebix chat again and then inspect the browser console, and we can also room that our messages are pushed out only phoejix people in that specific chat room. Great, chat it will be picked up by our WaterCoolerChannel.
If we refresh the - our messages are lost! And in the app. We see our chat with our body rrooms name fields. Our last piece will be to update our template to load any existing messages for the room.