예제 #1
0
 async def stomp_disconnect(self, receipt=None):
     self.log.info('STOMP DISCONNECT receipt=' + receipt)
     frame = StompFrame()
     frame.set_command("DISCONNECT")
     if receipt is not None:
         frame.set_header('receipt', receipt)
     out = StringIO()
     frame.write(out)
     await self.ws.send(out.getvalue().encode('utf-8'))
예제 #2
0
 async def stomp_subscribe(self, topic):
     self.log.debug('STOMP SUBSCRIBE topic=' + topic)
     frame = StompFrame()
     frame.set_command("SUBSCRIBE")
     frame.set_header('destination', topic)
     frame.set_header('id', 'my-id')
     out = StringIO()
     frame.write(out)
     await self.ws.send(out.getvalue().encode('utf-8'))
예제 #3
0
 async def stomp_connect(self, hostname):
     self.log.debug('STOMP CONNECT host=' + hostname)
     frame = StompFrame()
     frame.set_command("CONNECT")
     frame.set_header('accept-version', '1.2')
     frame.set_header('host', hostname)
     out = StringIO()
     frame.write(out)
     await self.ws.send(out.getvalue().encode('utf-8'))
예제 #4
0
 async def stomp_send(self, topic, message):
     print('STOMP SEND topic=' + topic)
     frame = StompFrame()
     frame.set_command("SEND")
     frame.set_header('destination', topic)
     frame.set_content(message)
     out = StringIO()
     frame.write(out)
     await self.ws.send(out.getvalue().encode('utf-8'))
예제 #5
0
 async def stomp_send(self, topic, message):
     logger.debug('STOMP SEND topic=' + topic)
     frame = StompFrame()
     frame.set_command("SEND")
     frame.set_header('destination', topic)
     frame.set_header('content-length', str(len(message)))
     frame.set_content(message)
     out = StringIO()
     frame.write(out)
     await self.ws.send(out.getvalue().encode('utf-8'))
     logger.debug('stomp_send completed')