23 |
23 |
24 |
24 |
25 from __future__ import absolute_import |
25 from __future__ import absolute_import |
26 from __future__ import print_function |
26 from __future__ import print_function |
27 import json |
27 import json |
28 |
28 import time |
29 import os |
29 import os |
30 import json |
30 import json |
31 from autobahn.twisted import wamp |
31 from autobahn.twisted import wamp |
32 from autobahn.twisted.websocket import WampWebSocketClientFactory, connectWS |
32 from autobahn.twisted.websocket import WampWebSocketClientFactory, connectWS |
33 from autobahn.wamp import types, auth |
33 from autobahn.wamp import types, auth |
111 print(_('WAMP session left')) |
111 print(_('WAMP session left')) |
112 |
112 |
113 |
113 |
114 class ReconnectingWampWebSocketClientFactory(WampWebSocketClientFactory, ReconnectingClientFactory): |
114 class ReconnectingWampWebSocketClientFactory(WampWebSocketClientFactory, ReconnectingClientFactory): |
115 def clientConnectionFailed(self, connector, reason): |
115 def clientConnectionFailed(self, connector, reason): |
116 print(_("WAMP Client connection failed .. retrying ..")) |
116 print _("WAMP Client connection failed (%s) .. retrying .." %time.ctime()) |
117 ReconnectingClientFactory.clientConnectionFailed(self, connector, reason) |
117 ReconnectingClientFactory.clientConnectionFailed(self, connector, reason) |
118 |
118 |
119 def clientConnectionLost(self, connector, reason): |
119 def clientConnectionLost(self, connector, reason): |
120 print(_("WAMP Client connection lost .. retrying ..")) |
120 print _("WAMP Client connection lost (%s) .. retrying .." %time.ctime()) |
121 ReconnectingClientFactory.clientConnectionFailed(self, connector, reason) |
121 ReconnectingClientFactory.clientConnectionFailed(self, connector, reason) |
122 |
122 |
123 |
123 |
124 def LoadWampClientConf(wampconf): |
124 def LoadWampClientConf(wampconf): |
125 try: |
125 try: |