My chat controller is
lib/fchatapp_web/live/chat_live.ex
defmodule FchatappWeb.ChatLive do
use Phoenix.LiveView
@imp true
def mount(params, session, socket) do
IO.inspect "In mount"
# IO.inspect room
IO.inspect params
{:ok, assign(socket, room: params["room"])}
end
@imp true
def handle_event(room_id,params,socket) do
IO.inspect "Im here"
{:noreply, socket}
end
end
Here is my template
lib/fchatapp_web/live/chat_live.html.leex
<section id="main">
<div id="header-text">
<div id="title">
<p >Currently Chatting In <strong><%= @room %></strong></p>
<button><a href="">Leave Room</a></button>
</div>
</div>
<br>
<div id="chat-container">
<div id="messages-container">Chat goes here</div>
<%= f = form_for :chat, "#", id: "chat-form", phx_submit: :submit_message %>
<%= text_input f, :message, placeholder: "Enter your message..." %>
</form>
</div>
</section>
<style>
#title{
text-align: center;
}
#header-text{
margin: auto;
padding: 10px;
}
#chat-container{
margin: auto;
width: 50%;
height: 60%;
border: 5px solid #cccccc;
padding: 10px;
}
#messages-container{
flex-grow: 1;
}
</style>
Im new to elixir please help me to get this done Im following a tutorial Let’s build a real-time chat application with Elixir and Phoenix - YouTube