Anonymous committed 4aa49d6

updated the connect() method to fix missing headers to deal with
durable connections

Comments (0)

Files changed (2)

 import socket
 import random
-class Frame:
+class Frame(object):
     """Build and manage a STOMP Frame.
     This is useful for connecting to and communicating with
         self.my_name  = socket.gethostbyname(socket.gethostname())
         self.sock     = sock
-    def connect(self,sock):
+    def connect(self,sock, conf):
         """Connect to the STOMP server, get session id
         >>> frameobj.connect(sock)
         self.sock = sock
-        frame = self.build_frame({'command':'CONNECT','headers':{}})
+        frame = self.build_frame({'command':'CONNECT','headers':conf})
         self.body    = args.get('body')
         if want_receipt:
             receipt_stamp = str(random.randint(0,10000000))
-            self.headers['receipt'] = self.session.get('session') + "-" + receipt_stamp
+            self.headers['receipt'] = self.session.get('session') + "_" + receipt_stamp
         return self
     def as_string(self):
     def __str__(self):
         return repr(self.value)
-class Stomp:
+class Stomp(object):
     """Dead simple Python STOMP client library
     This is useful for connecting to and communicating with
-            self.frame.connect(self.sock)
+            self.frame.connect(self.sock, conf)
             self.connected = True
         except (socket.error,socket.timeout), err:
             print "Cannot connect to %s on port %d" %(,self.port)