add: websocket pings
This commit is contained in:
parent
25d2d25fbc
commit
d669cd4d4e
2 changed files with 36 additions and 18 deletions
|
@ -135,7 +135,6 @@
|
|||
<a
|
||||
class="w-full justify-start button {% if selected_channel == channel.id %}quaternary{% else %}camo{% endif %}"
|
||||
href="/chats/{{ selected_community }}/{{ channel.id }}"
|
||||
data-turbo="false"
|
||||
>
|
||||
{{ icon "rss" }}
|
||||
<b class="name shortest">{{ channel.title }}</b>
|
||||
|
@ -494,23 +493,28 @@
|
|||
const data = JSON.parse(msg.data);
|
||||
|
||||
if (msg.method === "Message" && window.CURRENT_PAGE === 0) {
|
||||
const element = document.createElement("div");
|
||||
element.style.display = "contents";
|
||||
element.innerHTML = await (
|
||||
await fetch(
|
||||
"/chats/{{ selected_community }}/{{ selected_channel }}/_render",
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
if (document.getElementById("stream_body")) {
|
||||
const element = document.createElement("div");
|
||||
element.style.display = "contents";
|
||||
element.innerHTML = await (
|
||||
await fetch(
|
||||
"/chats/{{ selected_community }}/{{ selected_channel }}/_render",
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({ data: msg.data }),
|
||||
},
|
||||
body: JSON.stringify({ data: msg.data }),
|
||||
},
|
||||
)
|
||||
).text();
|
||||
)
|
||||
).text();
|
||||
|
||||
document.getElementById("stream_body").prepend(element);
|
||||
clean_text();
|
||||
document.getElementById("stream_body").prepend(element);
|
||||
clean_text();
|
||||
} else {
|
||||
console.log("abandoned remote");
|
||||
socket.close();
|
||||
}
|
||||
} else if (msg.method === "Delete") {
|
||||
if (document.getElementById(`message-${data.id}`)) {
|
||||
document.getElementById(`message-${data.id}`).remove();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue