diff libervia.py @ 158:58442ed28f2b

browser side: basic disconnection management: hard reload is done on empty signal response
author Goffi <goffi@goffi.org>
date Sat, 05 Jan 2013 16:08:25 +0100
parents b17ec3a6a112
children b887186e8fc8
line wrap: on
line diff
--- a/libervia.py	Sat Jan 05 16:07:33 2013 +0100
+++ b/libervia.py	Sat Jan 05 16:08:25 2013 +0100
@@ -86,7 +86,7 @@
                          "joinMUC", "getRoomsJoined", "launchTarotGame", "getTarotCardsPaths", "tarotGameReady", "tarotGameContratChoosed",
                          "tarotGamePlayCards", "launchRadioCollective", "getWaitingSub", "subscription", "delContact", "updateContact", "getEntityData", "getParamsUI",
                          #"setParam",
-                         "launchAction",
+                         "launchAction", "disconnect",
                         ])
 
 class BridgeSignals(LiberviaJsonProxy):
@@ -104,7 +104,10 @@
     
     
     def onRemoteError(self, code, errobj, request_info):
-        LiberviaJsonProxy.onRemoteError(self, code, errobj, request_info) 
+        if errobj['message'] == 'Empty Response':
+            Window.getLocation().reload() # XXX: reset page in case of session ended.
+                                          # FIXME: Should be done more properly without hard reload
+        LiberviaJsonProxy.onRemoteError(self, code, errobj, request_info)
         #we now try to reconnect
         if isinstance(errobj['message'],dict) and errobj['message']['faultCode']==0:
            Window.alert('You are not allowed to connect to server')