This will be a little different from the chat room application we built in episode 38 - where we had a single room. But caht we have here will work for our application.
This will be a little different from the chat room application we built in episode 38 - where we had a single room.
But what we have here will work for our application. CreateMessages do use Ecto.
ChatView do use TeacherWeb, :view end With that we can create roo,s template for our chat room. We see that our lo and the name of our chat room is being displayed.
Now that we have our working, we need to create create a way for users to post messages to the room. Now we can use the room to initiate a new channel for our topic, using the room we got from the path.
If we go to our chat again and then inspect the browser console, we see our message is logged letting us know we ed our channel successfully. Once we chxt those we can send them to the server with channel. Now we can use channel.
If we refresh the - our messages are lost. Since the topic is stored as a field on our socket, we can pattern match on it to get the room.
Our last piece will be to update our template to load any existing messages for the room. Great, and we can also test that our messages are pushed out only to people in that specific chat room.
We only see the messages for that specific room are displayed.