Ejemplo n.º 1
0
async def send_data(client):

    while True:
        body = 'fake message - {}'.format(
            datetime.utcnow().isoformat(timespec='seconds'))
        msg = {'message': body}
        message = Message(msgtype='Test',
                          sender_id='me',
                          subject='test',
                          body=msg)
        # print('send_data: {}'.format(msg))

        print('send_data: {}'.format(message.to_json()))
        # await client.send(json.dumps(msg))
        await client.send_message(message)
        await asyncio.sleep(1)
Ejemplo n.º 2
0
async def send_data(client):

    while True:
        body = 'read'
        msg = {'message': body}
        message = Message(msgtype='Test',
                          sender_id='me',
                          subject='cmd',
                          body=msg)
        # print('send_data: {}'.format(msg))

        print('send_data: {}'.format(message.to_json()))
        # await client.send(json.dumps(msg))
        # await client.send('rtclck\n')
        await client.send('read\n')
        await client.send('raw=2\n')
        # await client.send_message(message)
        await asyncio.sleep(1)