My tests with uwebsockets on circuitpython before maybe making a genuine fork/port.
The code has been adpated to the ESP32S2 firt, then back to using socket.recv and such. It is not currently based on the latest uwebsockets, but an older version that I was using and worked with my code. Don't forget to fill in the wifi SSID and password in secrets.py.
-
Create a
websockets.Sessionwith:- socket the socket module.
- ssl= the
ssl_contextfor S2 (optional). - iface= the
ESP_SPIcontrolinterface object (optional).
-
with session.client(url) as ws- Connect as a client and return the WebSockets object.
- Url is
ws://server:portorwss://server:port - Use
ws.sendandws.recvto exchange data with the server.
-
Uses a UniversalSocket abstraction class to encapsulate the differences.
uwebsocketsclient and protocol are left as unchanged as possible.- (For now)
-
Tested on FeatherS2.
-
Tested on nrf52840 Feather + Airflit Featherwing.
Original uwebsockets implementation: https://github.com/danni/uwebsockets
SPDX-FileCopyrightText: Copyright (c) 2022 Neradoc SPDX-License-Identifier: MIT