高速list消息

配合 https://create.codelab.club/projects/9939/editor 使用

import time
from codelab_adapter_client import AdapterNode

class MyNode(AdapterNode):
    NODE_ID = "eim/list_data"

    def __init__(self):
        super().__init__()
    
    def send_data(self, content):
        message = self.message_template()
        message["payload"]["content"] = content
        self.publish(message)

node = MyNode()
node.receive_loop_as_thread()
time.sleep(0.1) # 等待zmq通信管道建立完成

之后快速发送消息(测试100条/s是稳定的):

for i in range(1, 100):
    print(i)
    time.sleep(1/100) # 每秒100条
    node.send_data([[i,2,3], [1,2,3]])
1赞