本站改版新增arduino频道

Micropython
Arduino

micropython esp32 socketio client 客户端


socketio_client

import logging

import usocketio.client

logging.basicConfig(level=logging.DEBUG)

def hello():
    with usocketio.client.connect('http://127.0.0.1:5000/') as socketio:
        @socketio.on('message')
        def on_message(self, message):
            print("message", message)

        @socketio.on('alert')
        def on_alert(self, message):
            print("alert", message)

        socketio.run_forever()

hello()

来源:https://github.com/danni/uwebsockets/



推荐分享
图文皆来源于网络,内容仅做公益性分享,版权归原作者所有,如有侵权请告知删除!
 

Copyright © 2014 ESP56.com All Rights Reserved
晋ICP备14006235号-22 晋公网安备14108102001165号

执行时间: 0.0095450878143311 seconds