1. Philippe May
  2. txWebsocketClient

Commits

Philippe May  committed 92ba817 Merge

Merge

  • Participants
  • Parent commits af85b71, c1931e7
  • Branches default

Comments (0)

Files changed (2)

File autobahn_test_client.py

View file
 #!/usr/bin/env python
 
+from __future__ import print_function
 from twisted.internet import reactor
 from websocket_client import WebSocketClientFactory, WebSocketClientHandler
 from twisted.internet.endpoints import TCP4ClientEndpoint
         return "<AutobahnTestSuiteClient, case %d>" % self.factory.case
 
     def connectionEstablished(self):
-        print("Case %d" % self.factory.case)
+        print("Case %d: " % self.factory.case, end="")
 
     def frameReceived(self, data):
         ## Just write data back
         self.writeBinary(data)
 
     def connectionLost(self, reason):
+        print(reason.getErrorMessage())
         if self.factory.case < self.factory.last_case:
             reactor.connectTCP(host,
                                port,
     handler = AutobahnUpdateReportClient
     def __init__(self, base_url):
         host = urlparse(base_url).hostname
-        print("Updating report (check result at: http://%s:9090/reports/clients/index.html)"
-                                % host)
+        print("Updating report (check result at: http://%s:9090/reports/clients/index.html): "
+                                % host, end="")
         WebSocketClientFactory.__init__(self,
                                         base_url + "updateReports?agent=%s" % AGENT)
 
         factory = AutobahnUpdateReportClientFactory(base_url=args.url)
         point.connect(factory).addErrback(no_tcp_connection)
     else:
-        print "You must provide at least one of -a, -c or -u option"
+        print("You must provide at least one of -a, -c or -u option")
         parser.print_usage()
         import sys
         sys.exit(1)

File websocket_client.py

View file
         try:
             self._state(data)
         except (DecodingError, FrameLengthExceeded), error:
-            self.protocol.close(error.status_code, "")
+            self.protocol.close(error.status_code, error.args[0])
+            self.closing = True
             return
 
         while self._consumed_all == 0 and not self.closing:
             try:
                 self._state(None)
             except (DecodingError, FrameLengthExceeded), error:
-                self.protocol.close(error.status_code, "")
+                self.protocol.close(error.status_code,  error.args[0])
                 break