Commits

Anonymous committed 5e951a0

add basic context manager support for client connection

Comments (0)

Files changed (1)

stompclient/simplex.py

                 pass
             return result
         
+    def __enter__(self):
+        self.connect()
+        return self
+
+    def __exit__(self, exc_type, exc_value, traceback):
+        self.disconnect()
+
+
     def send(self, destination, body=None, transaction=None, extra_headers=None):
         """
         Sends a message to STOMP server.