diff libervia/pages/chat/page_meta.py @ 1504:409d10211b20

server, browser: dynamic pages refactoring: dynamic pages has been reworked, to change the initial basic implementation. Pages are now dynamic by default, and a websocket is established by the first connected page of a session. The socket is used to transmit bridge signals, and then the signal is broadcasted to other tabs using broadcast channel. If the connecting tab is closed, an other one is chosen. Some tests are made to retry connecting in case of problem, and sometimes reload the pages (e.g. if profile is connected). Signals (or other data) are cached during reconnection phase, to avoid lost of data. All previous partial rendering mechanism have been removed, chat page is temporarily not working anymore, but will be eventually redone (one of the goal of this work is to have proper chat).
author Goffi <goffi@goffi.org>
date Wed, 01 Mar 2023 18:02:44 +0100
parents 01936fc55cd9
children ce879da7fcf7
line wrap: on
line diff
--- a/libervia/pages/chat/page_meta.py	Wed Mar 01 17:55:25 2023 +0100
+++ b/libervia/pages/chat/page_meta.py	Wed Mar 01 18:02:44 2023 +0100
@@ -120,36 +120,3 @@
         )
     else:
         log.warning("unknown message type: {type}".format(type=data_type))
-
-
-@defer.inlineCallbacks
-def on_signal(self, request, signal, *args):
-    if signal == "messageNew":
-        rdata = self.getRData(request)
-        template_data_update = {"msg": data_objects.Message((args))}
-        target_jid = rdata["target"]
-        identities = rdata["identities"]
-        uid, timestamp, from_jid_s, to_jid_s, message, subject, mess_type, extra_s, __ = (
-            args
-        )
-        from_jid = jid.JID(from_jid_s)
-        to_jid = jid.JID(to_jid_s)
-        if (
-            target_jid.userhostJID() != from_jid.userhostJID()
-            and target_jid.userhostJID() != to_jid.userhostJID()
-        ):
-            # the message is not linked with page's room/user
-            return
-
-        if from_jid_s not in identities:
-            profile = self.getProfile(request)
-            id_raw = yield self.host.bridgeCall(
-                "identityGet", from_jid_s, [], True, profile
-            )
-            identities[from_jid_s] = data_format.deserialise(id_raw)
-            template_data_update["identities"] = identities
-        self.renderAndUpdate(
-            request, "chat/message.html", "#messages", template_data_update
-        )
-    else:
-        log.error(_("Unexpected signal: {signal}").format(signal=signal))