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