Esempio n. 1
0
    async def respond_using_ws(command: DittoCommand, count, delay_in_sec, request_id, response_url):
        logging.info("Responding over url= %s; delay= %s ms", response_url, delay_in_sec)
        ws = create_connection(response_url)

        idx = str(random.randint(0, 1000))
        sub = stomper.subscribe("/data", idx, ack='auto')
        ws.send(sub)
        for i in range(count):
            post_data = MeasurementData(request_id, count, i)
            time.sleep(delay_in_sec)
            msg = stomper.send(dest="/app/data", msg=post_data.to_json(), content_type="application/json")
            logging.debug("Going to send stomp message: %s", msg)
            ws.send(msg)
            # ws.send("some trash")
            # await ws.send(post_data.to_json())
            # await ws.recv()

        ws.send(stomper.unsubscribe(idx))
Esempio n. 2
0
 def testUnsubscribe(self):
     dest = '/queue/all'
     correct = "UNSUBSCRIBE\ndestination:%s\n\n\x00\n" % dest
     self.assertEquals(stomper.unsubscribe(dest), correct)
Esempio n. 3
0
 def testUnsubscribe(self):
     subscription = '1'
     correct = "UNSUBSCRIBE\nid:%s\n\n\x00\n" % subscription
     self.assertEquals(stomper.unsubscribe(subscription), correct)
Esempio n. 4
0
 def testUnsubscribe(self):
     dest = '/queue/all'
     correct = "UNSUBSCRIBE\ndestination:%s\n\n\x00\n" % dest
     self.assertEquals(stomper.unsubscribe(dest), correct)
Esempio n. 5
0
 def testUnsubscribe(self):
     subscription = '1'
     correct = "UNSUBSCRIBE\nid:%s\n\n\x00\n" % subscription
     self.assertEquals(stomper.unsubscribe(subscription), correct)