本站改版新增arduino频道
库地址:https://github.com/danni/uwebsockets/
代码1:
import uwebsockets.client uri = "wss://echo.websocket.org/" websocket = uwebsockets.client.connect(uri) print("Connecting to {}:".format(uri)) 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()
代码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()
Copyright © 2014 ESP56.com All Rights Reserved
晋ICP备14006235号-22 晋公网安备14108102001165号
执行时间: 0.0097119808197021 seconds