Micropython学习交流群 学习QQ群:786510434 提供多种固件下载和学习交流。
Micropython-扇贝物联 QQ群:31324057 扇贝物联是一个让你与智能设备沟通更方便的物联网云平台
Micropython学习交流群 学习QQ群:468985481 学习交流ESP8266、ESP32、ESP8285、wifi模块开发交流、物联网。
Micropython老哥俩的IT农场分享QQ群:929132891 为喜欢科创制作的小白们分享一些自制的计算机软硬件免费公益课程,由两位多年从事IT研发的中年大叔发起。
import uwebsockets.client import os def hello(): with uwebsockets.client.connect('ws://139.196.55.124:8181') as websocket: uname = os.uname() name = '{sysname} {release} {version} {machine}'.format( sysname=uname.sysname, release=uname.release, version=uname.version, machine=uname.machine, ) websocket.send(name) print("> {}".format(name)) greeting = websocket.recv() print("< {}".format(greeting)) hello()
代码2:
import uwebsockets.client websocket = uwebsockets.client.connect("ws://echo.websocket.org/") mesg = "The quick brown fox jumps over the lazy dog" websocket.send(mesg + "\r\n") resp = websocket.recv() print(resp) assert(mesg + "\r\n" == resp) # close the socket to reclaim memory websocket.close()
库地址:https://github.com/danni/uwebsockets/
Copyright © 2014 ESP56.com All Rights Reserved
执行时间: 0.0089461803436279 seconds