This chatroom is only chat through phoenix websocket.You need to pass jwt token to include user info.
mix deps.get && mix phoenix.server
use distillery
gem 'jwt'
# app/helpers/application_helper.rb
CHATROOM_ADMIN_LIST = [1,....] #user id
def chat_token
payload = {
jti: #user id
iss: #user name
sub: #user unique name
adi: #user is a admin or not
}
JWT.encode payload, private_key, 'HS256' # same as phoenix private_key
end
<iframe frameborder="0" name="Iframe1" src="https://localhost:4000/?xtoken=<%= chatroom_token %>" width="100%" height="380" scrolling="no"></iframe>