60558cb8ec3e8ca18324211a787a7a8c84471849
[akkoma] / lib / pleroma / web / chat_channel.ex
1 defmodule Pleroma.Web.ChatChannel do
2 use Phoenix.Channel
3
4 def join("chat:public", _message, socket) do
5 {:ok, socket}
6 end
7
8 def handle_in("new_msg", %{"text" => text}, socket) do
9 author = socket.assigns[:user]
10 author = Pleroma.Web.MastodonAPI.AccountView.render("account.json", user: author)
11 broadcast! socket, "new_msg", %{text: text, author: author}
12 {:noreply, socket}
13 end
14 end