本站改版新增arduino频道
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
晋ICP备14006235号-22 晋公网安备14108102001165号
执行时间: 0.0096259117126465 seconds