changeset 1506:ce879da7fcf7

server: fix `on_signal` callback
author Goffi <goffi@goffi.org>
date Thu, 23 Mar 2023 17:50:54 +0100
parents a169cbc315f0
children ae5158f3c420
files libervia/pages/_browser/bridge.py libervia/pages/blog/page_meta.py libervia/pages/chat/page_meta.py libervia/pages/files/list/page_meta.py libervia/pages/forums/topics/page_meta.py libervia/pages/g/page_meta.py libervia/pages/lists/view_item/page_meta.py libervia/pages/login/logged/page_meta.py libervia/pages/login/page_meta.py libervia/pages/merge-requests/view/page_meta.py libervia/pages/register/page_meta.py libervia/server/pages.py libervia/server/server.py libervia/server/session_iface.py libervia/server/websockets.py
diffstat 15 files changed, 87 insertions(+), 86 deletions(-) [+]
line wrap: on
line diff
--- a/libervia/pages/_browser/bridge.py	Sat Mar 04 18:37:17 2023 +0100
+++ b/libervia/pages/_browser/bridge.py	Thu Mar 23 17:50:54 2023 +0100
@@ -106,6 +106,9 @@
         msg_data = json.loads(message_evt.data)
         msg_type = msg_data.get("type")
         if msg_type == "bridge":
+            log.debug(
+                f"==> bridge message: {msg_data=}"
+            )
             self.broadcast_channel.post(
                 msg_type,
                 msg_data["data"]
--- a/libervia/pages/blog/page_meta.py	Sat Mar 04 18:37:17 2023 +0100
+++ b/libervia/pages/blog/page_meta.py	Thu Mar 23 17:50:54 2023 +0100
@@ -35,7 +35,7 @@
         )
         entities_url = template_data["entities_url"] = {}
         identities = self.host.getSessionData(
-            request, session_iface.ISATSession
+            request, session_iface.IWebSession
         ).identities
         d_list = {}
         for entity_jid_s in entities:
--- a/libervia/pages/chat/page_meta.py	Sat Mar 04 18:37:17 2023 +0100
+++ b/libervia/pages/chat/page_meta.py	Thu Mar 23 17:50:54 2023 +0100
@@ -43,7 +43,7 @@
 @defer.inlineCallbacks
 def prepare_render(self, request):
     #  FIXME: bug on room filtering (currently display messages from all rooms)
-    session = self.host.getSessionData(request, session_iface.ISATSession)
+    session = self.host.getSessionData(request, session_iface.IWebSession)
     template_data = request.template_data
     rdata = self.getRData(request)
     target_jid = rdata["target"]
@@ -97,7 +97,7 @@
 
 
 def on_data(self, request, data):
-    session = self.host.getSessionData(request, session_iface.ISATSession)
+    session = self.host.getSessionData(request, session_iface.IWebSession)
     rdata = self.getRData(request)
     target = rdata["target"]
     data_type = data.get("type", "")
--- a/libervia/pages/files/list/page_meta.py	Sat Mar 04 18:37:17 2023 +0100
+++ b/libervia/pages/files/list/page_meta.py	Thu Mar 23 17:50:54 2023 +0100
@@ -45,7 +45,7 @@
     path = Path('/', *path_elts)
     profile = self.getProfile(request) or C.SERVICE_PROFILE
     session_data = self.host.getSessionData(
-        request, session_iface.ISATSession
+        request, session_iface.IWebSession
     )
 
     try:
--- a/libervia/pages/forums/topics/page_meta.py	Sat Mar 04 18:37:17 2023 +0100
+++ b/libervia/pages/forums/topics/page_meta.py	Thu Mar 23 17:50:54 2023 +0100
@@ -46,7 +46,7 @@
     metadata = data_format.deserialise(metadata)
     self.setPagination(request, metadata)
     identities = self.host.getSessionData(
-        request, session_iface.ISATSession
+        request, session_iface.IWebSession
     ).identities
     for topic in topics:
         parsed_uri = xmpp_uri.parseXMPPUri(topic["uri"])
--- a/libervia/pages/g/page_meta.py	Sat Mar 04 18:37:17 2023 +0100
+++ b/libervia/pages/g/page_meta.py	Thu Mar 23 17:50:54 2023 +0100
@@ -22,8 +22,8 @@
     except IndexError:
         self.pageError(request)
 
-    sat_session, guest_session = self.host.getSessionData(
-        request, session_iface.ISATSession, session_iface.ISATGuestSession
+    web_session, guest_session = self.host.getSessionData(
+        request, session_iface.IWebSession, session_iface.ISATGuestSession
     )
     current_id = guest_session.id
 
@@ -34,13 +34,13 @@
             ).format(old_id=current_id, new_id=invitation_id)
         )
         self.host.purgeSession(request)
-        sat_session, guest_session = self.host.getSessionData(
-            request, session_iface.ISATSession, session_iface.ISATGuestSession
+        web_session, guest_session = self.host.getSessionData(
+            request, session_iface.IWebSession, session_iface.ISATGuestSession
         )
         current_id = None  # FIXME: id not reset here
         profile = None
 
-    profile = sat_session.profile
+    profile = web_session.profile
     if profile is not None and current_id is None:
         log.info(
             _(
@@ -48,8 +48,8 @@
             ).format(profile=profile)
         )
         self.host.purgeSession(request)
-        sat_session, guest_session = self.host.getSessionData(
-            request, session_iface.ISATSession, session_iface.ISATGuestSession
+        web_session, guest_session = self.host.getSessionData(
+            request, session_iface.IWebSession, session_iface.ISATGuestSession
         )
         profile = None
 
--- a/libervia/pages/lists/view_item/page_meta.py	Sat Mar 04 18:37:17 2023 +0100
+++ b/libervia/pages/lists/view_item/page_meta.py	Thu Mar 23 17:50:54 2023 +0100
@@ -43,7 +43,7 @@
 async def prepare_render(self, request):
     data = self.getRData(request)
     template_data = request.template_data
-    session = self.host.getSessionData(request, session_iface.ISATSession)
+    session = self.host.getSessionData(request, session_iface.IWebSession)
     service, node, item_id = (
         data.get("service", ""),
         data.get("node", ""),
--- a/libervia/pages/login/logged/page_meta.py	Sat Mar 04 18:37:17 2023 +0100
+++ b/libervia/pages/login/logged/page_meta.py	Thu Mar 23 17:50:54 2023 +0100
@@ -13,6 +13,6 @@
 
 def prepare_render(self, request):
     template_data = request.template_data
-    session_data = self.host.getSessionData(request, session_iface.ISATSession)
+    session_data = self.host.getSessionData(request, session_iface.IWebSession)
     template_data["guest_session"] = session_data.guest
     template_data["session_started"] = session_data.started
--- a/libervia/pages/login/page_meta.py	Sat Mar 04 18:37:17 2023 +0100
+++ b/libervia/pages/login/page_meta.py	Thu Mar 23 17:50:54 2023 +0100
@@ -26,7 +26,7 @@
         self.pageRedirect("/login/logged", request)
 
     # login error message
-    session_data = self.host.getSessionData(request, session_iface.ISATSession)
+    session_data = self.host.getSessionData(request, session_iface.IWebSession)
     login_error = session_data.popPageData(self, "login_error")
     if login_error is not None:
         template_data["S_C"] = C  # we need server constants in template
@@ -49,7 +49,7 @@
     @param error_const(unicode): one of login error constant
     @return C.POST_NO_CONFIRM: avoid confirm message
     """
-    session_data = self.host.getSessionData(request, session_iface.ISATSession)
+    session_data = self.host.getSessionData(request, session_iface.IWebSession)
     session_data.setPageData(self, "login_error", error_const)
     return C.POST_NO_CONFIRM
 
--- a/libervia/pages/merge-requests/view/page_meta.py	Sat Mar 04 18:37:17 2023 +0100
+++ b/libervia/pages/merge-requests/view/page_meta.py	Thu Mar 23 17:50:54 2023 +0100
@@ -31,7 +31,7 @@
 async def prepare_render(self, request):
     data = self.getRData(request)
     template_data = request.template_data
-    session = self.host.getSessionData(request, session_iface.ISATSession)
+    session = self.host.getSessionData(request, session_iface.IWebSession)
     service, node, list_item_id = (
         data.get("service", ""),
         data.get("node", ""),
--- a/libervia/pages/register/page_meta.py	Sat Mar 04 18:37:17 2023 +0100
+++ b/libervia/pages/register/page_meta.py	Thu Mar 23 17:50:54 2023 +0100
@@ -26,7 +26,7 @@
     template_data["S_C"] = C  # we need server constants in template
 
     # login error message
-    session_data = self.host.getSessionData(request, session_iface.ISATSession)
+    session_data = self.host.getSessionData(request, session_iface.IWebSession)
     login_error = session_data.popPageData(self, "login_error")
     if login_error is not None:
         template_data["login_error"] = login_error
@@ -44,7 +44,7 @@
             request, ("login", "email", "password")
         )
         status = yield self.host.registerNewAccount(request, login, password, email)
-        session_data = self.host.getSessionData(request, session_iface.ISATSession)
+        session_data = self.host.getSessionData(request, session_iface.IWebSession)
         if status == C.REGISTRATION_SUCCEED:
             # we prefill login field for login page
             session_data.setPageData(self.getPageByName("login"), "login", login)
--- a/libervia/server/pages.py	Sat Mar 04 18:37:17 2023 +0100
+++ b/libervia/server/pages.py	Thu Mar 23 17:50:54 2023 +0100
@@ -542,7 +542,7 @@
 
     def checkCSRF(self, request):
         session = self.host.getSessionData(
-            request, session_iface.ISATSession
+            request, session_iface.IWebSession
         )
         if session.profile is None:
             # CSRF doesn't make sense when no user is logged
@@ -1078,7 +1078,7 @@
             if profile != C.SERVICE_PROFILE:
                 #  only service profile is cached for now
                 return
-            session_data = self.host.getSessionData(request, session_iface.ISATSession)
+            session_data = self.host.getSessionData(request, session_iface.IWebSession)
             locale = session_data.locale
             if locale == C.DEFAULT_LOCALE:
                 # no need to duplicate cache here
@@ -1159,7 +1159,7 @@
         profile = self.getProfile(request) or C.SERVICE_PROFILE
         identities = self.host.getSessionData(
             request,
-            session_iface.ISATSession
+            session_iface.IWebSession
         ).identities
         for e in entities:
             if e not in identities:
@@ -1276,7 +1276,7 @@
         else:
             template = "error/" + str(code) + ".html"
             template_data = request.template_data
-            session_data = self.host.getSessionData(request, session_iface.ISATSession)
+            session_data = self.host.getSessionData(request, session_iface.IWebSession)
             if session_data.locale is not None:
                 template_data['locale'] = session_data.locale
             if self.vhost_root.site_name:
@@ -1338,7 +1338,7 @@
                 raise failure.Failure(exceptions.CancelError("subpage page is used"))
 
     def _prepare_dynamic(self, request):
-        session_data = self.host.getSessionData(request, session_iface.ISATSession)
+        session_data = self.host.getSessionData(request, session_iface.IWebSession)
         # we need to activate dynamic page
         # we set data for template, and create/register token
         # socket_token = str(uuid.uuid4())
@@ -1359,7 +1359,7 @@
         template_data = request.template_data
 
         # if confirm variable is set in case of successfuly data post
-        session_data = self.host.getSessionData(request, session_iface.ISATSession)
+        session_data = self.host.getSessionData(request, session_iface.IWebSession)
         template_data['identities'] = session_data.identities
         if session_data.popPageFlag(self, C.FLAG_CONFIRM):
             template_data["confirm"] = True
@@ -1441,7 +1441,7 @@
             raise NotImplementedError(
                 _("iterable in on_data_post return value is not used yet")
             )
-        session_data = self.host.getSessionData(request, session_iface.ISATSession)
+        session_data = self.host.getSessionData(request, session_iface.IWebSession)
         request_data = self.getRData(request)
         if "post_redirect_page" in request_data:
             redirect_page_data = request_data["post_redirect_page"]
@@ -1470,7 +1470,7 @@
         except exceptions.DataError as e:
             # something is wrong with the posted data, we re-display the page with a
             # warning notification
-            session_data = self.host.getSessionData(request, session_iface.ISATSession)
+            session_data = self.host.getSessionData(request, session_iface.IWebSession)
             session_data.setPageNotification(self, str(e), C.LVL_WARNING)
             request.setResponseCode(C.HTTP_SEE_OTHER)
             request.setHeader("location", request.uri)
@@ -1561,16 +1561,16 @@
         @return (unicode, None): current profile
             None if no profile session is started
         """
-        sat_session = self.host.getSessionData(request, session_iface.ISATSession)
-        return sat_session.profile
+        web_session = self.host.getSessionData(request, session_iface.IWebSession)
+        return web_session.profile
 
     def getJid(self, request):
         """Helper method to easily get current jid
 
         @return: current jid
         """
-        sat_session = self.host.getSessionData(request, session_iface.ISATSession)
-        return sat_session.jid
+        web_session = self.host.getSessionData(request, session_iface.IWebSession)
+        return web_session.jid
 
 
     def getRData(self, request):
@@ -1589,13 +1589,13 @@
 
     def getPageData(self, request, key):
         """Helper method to retrieve reload resistant data"""
-        sat_session = self.host.getSessionData(request, session_iface.ISATSession)
-        return sat_session.getPageData(self, key)
+        web_session = self.host.getSessionData(request, session_iface.IWebSession)
+        return web_session.getPageData(self, key)
 
     def setPageData(self, request, key, value):
         """Helper method to set reload resistant data"""
-        sat_session = self.host.getSessionData(request, session_iface.ISATSession)
-        return sat_session.setPageData(self, key, value)
+        web_session = self.host.getSessionData(request, session_iface.IWebSession)
+        return web_session.setPageData(self, key, value)
 
     def handleSearch(self, request, extra):
         """Manage Full-Text Search
@@ -1649,7 +1649,7 @@
             for a in available:
                 if a.lower().startswith(lang):
                     session_data = self.host.getSessionData(request,
-                                                            session_iface.ISATSession)
+                                                            session_iface.IWebSession)
                     session_data.locale = a
                     return
 
@@ -1659,7 +1659,7 @@
         if not hasattr(request, "template_data"):
             # if template_data doesn't exist, it's the beginning of the request workflow
             # so we fill essential data
-            session_data = self.host.getSessionData(request, session_iface.ISATSession)
+            session_data = self.host.getSessionData(request, session_iface.IWebSession)
             profile = session_data.profile
             request.template_data = {
                 "profile": profile,
--- a/libervia/server/server.py	Sat Mar 04 18:37:17 2023 +0100
+++ b/libervia/server/server.py	Thu Mar 23 17:50:54 2023 +0100
@@ -134,7 +134,7 @@
         self._checkCallback(dir_path, wrapped_callback, recursive)
 
 
-class LiberviaSession(server.Session):
+class WebSession(server.Session):
     sessionTimeout = C.SESSION_TIMEOUT
 
     def __init__(self, *args, **kwargs):
@@ -1284,7 +1284,7 @@
             self.vhost_root, [server.GzipEncoderFactory()]
         )
         self.site = server.Site(wrapped)
-        self.site.sessionFactory = LiberviaSession
+        self.site.sessionFactory = WebSession
 
     def _bridgeCb(self):
         del self._bridge_retry
@@ -1368,13 +1368,11 @@
         if not profile:
             log.error(f"got signal without profile: {signal_name}, {args}")
             return
-        try:
-            sockets = websockets.LiberviaPageWSProtocol.profile_map[profile]
-        except KeyError:
-            log.debug(f"no socket opened for profile {profile}")
-            return
-        for socket in sockets:
-            socket.send("bridge", {"signal": signal_name, "args": args})
+        session_iface.WebSession.send(
+            profile,
+            "bridge",
+            {"signal": signal_name, "args": args}
+        )
 
     def application_started_handler(
         self,
@@ -1412,37 +1410,37 @@
         register_with_ext_jid = self.waiting_profiles.getRegisterWithExtJid(profile)
         self.waiting_profiles.purgeRequest(profile)
         session = request.getSession()
-        sat_session = session_iface.ISATSession(session)
-        if sat_session.profile:
+        web_session = session_iface.IWebSession(session)
+        if web_session.profile:
             log.error(_("/!\\ Session has already a profile, this should NEVER happen!"))
             raise failure.Failure(exceptions.ConflictError("Already active"))
 
         # XXX: we force string because python D-Bus has its own string type (dbus.String)
         #   which may cause trouble when exposing it to scripts
-        sat_session.profile = str(profile)
+        web_session.profile = str(profile)
         self.prof_connected.add(profile)
         cache_dir = os.path.join(
             self.cache_root_dir, "profiles", regex.pathEscape(profile)
         )
         # FIXME: would be better to have a global /cache URL which redirect to
         #        profile's cache directory, without uuid
-        self.cache_resource.putChild(sat_session.uuid.encode('utf-8'),
+        self.cache_resource.putChild(web_session.uuid.encode('utf-8'),
                                      ProtectedFile(cache_dir))
         log.debug(
             _("profile cache resource added from {uuid} to {path}").format(
-                uuid=sat_session.uuid, path=cache_dir
+                uuid=web_session.uuid, path=cache_dir
             )
         )
 
         def on_expire():
             log.info("Session expired (profile={profile})".format(profile=profile))
-            self.cache_resource.delEntity(sat_session.uuid.encode('utf-8'))
+            self.cache_resource.delEntity(web_session.uuid.encode('utf-8'))
             log.debug(
-                _("profile cache resource {uuid} deleted").format(uuid=sat_session.uuid)
+                _("profile cache resource {uuid} deleted").format(uuid=web_session.uuid)
             )
-            sat_session.on_expire()
-            if sat_session.ws_socket is not None:
-                sat_session.ws_socket.close()
+            web_session.on_expire()
+            if web_session.ws_socket is not None:
+                web_session.ws_socket.close()
             # and now we disconnect the profile
             self.bridgeCall("disconnect", profile)
 
@@ -1450,12 +1448,12 @@
 
         # FIXME: those session infos should be returned by connect or isConnected
         infos = await self.bridgeCall("sessionInfosGet", profile)
-        sat_session.jid = jid.JID(infos["jid"])
-        own_bare_jid_s = sat_session.jid.userhost()
+        web_session.jid = jid.JID(infos["jid"])
+        own_bare_jid_s = web_session.jid.userhost()
         own_id_raw = await self.bridgeCall(
             "identityGet", own_bare_jid_s, [], True, profile)
-        sat_session.identities[own_bare_jid_s] = data_format.deserialise(own_id_raw)
-        sat_session.backend_started = int(infos["started"])
+        web_session.identities[own_bare_jid_s] = data_format.deserialise(own_id_raw)
+        web_session.backend_started = int(infos["started"])
 
         state = C.PROFILE_LOGGED_EXT_JID if register_with_ext_jid else C.PROFILE_LOGGED
         return state
@@ -1544,15 +1542,15 @@
             connect_method = "connect"
 
         # we check if there is not already an active session
-        sat_session = session_iface.ISATSession(request.getSession())
-        if sat_session.profile:
+        web_session = session_iface.IWebSession(request.getSession())
+        if web_session.profile:
             # yes, there is
-            if sat_session.profile != profile:
+            if web_session.profile != profile:
                 # it's a different profile, we need to disconnect it
                 log.warning(_(
                     "{new_profile} requested login, but {old_profile} was already "
                     "connected, disconnecting {old_profile}").format(
-                        old_profile=sat_session.profile, new_profile=profile))
+                        old_profile=web_session.profile, new_profile=profile))
                 self.purgeSession(request)
 
         if self.waiting_profiles.getRequest(profile):
@@ -1589,16 +1587,16 @@
         if connected:
             #  profile is already connected in backend
             # do we have a corresponding session in Libervia?
-            sat_session = session_iface.ISATSession(request.getSession())
-            if sat_session.profile:
+            web_session = session_iface.IWebSession(request.getSession())
+            if web_session.profile:
                 # yes, session is active
-                if sat_session.profile != profile:
+                if web_session.profile != profile:
                     # existing session should have been ended above
                     # so this line should never be reached
                     log.error(_(
                         "session profile [{session_profile}] differs from login "
                         "profile [{profile}], this should not happen!")
-                            .format(session_profile=sat_session.profile, profile=profile))
+                            .format(session_profile=web_session.profile, profile=profile))
                     raise exceptions.InternalError("profile mismatch")
                 defer.returnValue(C.SESSION_ACTIVE)
             log.info(
@@ -1845,8 +1843,8 @@
         session = request.session
         if session is not None:
             log.debug(_("session purge"))
-            sat_session = self.getSessionData(request, session_iface.ISATSession)
-            socket = sat_session.ws_socket
+            web_session = self.getSessionData(request, session_iface.IWebSession)
+            socket = web_session.ws_socket
             if socket is not None:
                 socket.close()
                 session.ws_socket = None
@@ -1878,16 +1876,16 @@
         @param node(unicode): pubsub node
         @return (unicode): affiliation
         """
-        sat_session = self.getSessionData(request, session_iface.ISATSession)
-        if sat_session.profile is None:
+        web_session = self.getSessionData(request, session_iface.IWebSession)
+        if web_session.profile is None:
             raise exceptions.InternalError("profile must be set to use this method")
-        affiliation = sat_session.getAffiliation(service, node)
+        affiliation = web_session.getAffiliation(service, node)
         if affiliation is not None:
             defer.returnValue(affiliation)
         else:
             try:
                 affiliations = yield self.bridgeCall(
-                    "psAffiliationsGet", service.full(), node, sat_session.profile
+                    "psAffiliationsGet", service.full(), node, web_session.profile
                 )
             except Exception as e:
                 log.warning(
@@ -1901,7 +1899,7 @@
                     affiliation = affiliations[node]
                 except KeyError:
                     affiliation = ""
-            sat_session.setAffiliation(service, node, affiliation)
+            web_session.setAffiliation(service, node, affiliation)
             defer.returnValue(affiliation)
 
     ## Websocket (dynamic pages) ##
@@ -1940,7 +1938,7 @@
         self.cache_resource.putChild(service_path.encode('utf-8'),
                                      ProtectedFile(cache_dir))
         self.service_cache_url = "/" + os.path.join(C.CACHE_DIR, service_path)
-        session_iface.SATSession.service_cache_url = self.service_cache_url
+        session_iface.WebSession.service_cache_url = self.service_cache_url
 
         if self.options["connection_type"] in ("https", "both"):
             try:
@@ -2011,7 +2009,7 @@
         return web_util.redirectTo(url.encode(), request)
 
 
-registerAdapter(session_iface.SATSession, server.Session, session_iface.ISATSession)
+registerAdapter(session_iface.WebSession, server.Session, session_iface.IWebSession)
 registerAdapter(
     session_iface.SATGuestSession, server.Session, session_iface.ISATGuestSession
 )
--- a/libervia/server/session_iface.py	Sat Mar 04 18:37:17 2023 +0100
+++ b/libervia/server/session_iface.py	Thu Mar 23 17:50:54 2023 +0100
@@ -37,16 +37,16 @@
 MAX_CACHE_AFFILIATIONS = 100  # number of nodes to keep in cache
 
 
-class ISATSession(Interface):
+class IWebSession(Interface):
     profile = Attribute("Sat profile")
     jid = Attribute("JID associated with the profile")
     uuid = Attribute("uuid associated with the profile session")
     identities = Attribute("Identities of XMPP entities")
 
 
-@implementer(ISATSession)
-class SATSession:
-    profiles_map: Dict[Optional[str], List["SATSession"]] = {}
+@implementer(IWebSession)
+class WebSession:
+    profiles_map: Dict[Optional[str], List["WebSession"]] = {}
 
     def __init__(self, session):
         self._profile = None
@@ -136,7 +136,7 @@
             )
 
     @classmethod
-    def get_profile_sessions(cls, profile: str) -> List["SATSession"]:
+    def get_profile_sessions(cls, profile: str) -> List["WebSession"]:
         return cls.profiles_map.get(profile, [])
 
     def getPageData(self, page, key):
--- a/libervia/server/websockets.py	Sat Mar 04 18:37:17 2023 +0100
+++ b/libervia/server/websockets.py	Thu Mar 23 17:50:54 2023 +0100
@@ -41,7 +41,7 @@
         super().__init__()
         self._init_ok: bool = False
         self.__profile: Optional[str] = None
-        self.__session: Optional[session_iface.SATSession] = None
+        self.__session: Optional[session_iface.WebSession] = None
 
     @property
     def init_ok(self):
@@ -52,7 +52,7 @@
         if not self._init_ok and data_type != "error":
             raise exceptions.InternalError(
                 "send called when not initialized, this should not happend! Please use "
-                "SATSession.send which takes care of sending correctly the data to all "
+                "WebSession.send which takes care of sending correctly the data to all "
                 "sessions."
             )
 
@@ -102,7 +102,7 @@
             )
 
         session.touch()
-        session_data = session.getComponent(session_iface.ISATSession)
+        session_data = session.getComponent(session_iface.IWebSession)
         if session_data.ws_socket is not None:
             log.warning("Session socket is already set, force closing it")
             session_data.ws_socket.send(
@@ -203,7 +203,7 @@
         else:
             log.debug(f"reseting websocket session for {self.__profile}")
             self.__session.ws_socket = None
-        sessions = session_iface.SATSession.get_profile_sessions(self.__profile)
+        sessions = session_iface.WebSession.get_profile_sessions(self.__profile)
         log.debug(f"websocket connection for profile {self.__profile} closed")
         self.__profile = None