https://github.com/neradoc/websockets-for-circuitpython
My test with uwebsockets before making a genuine port
https://github.com/neradoc/websockets-for-circuitpython
Last synced: 2 months ago
JSON representation
My test with uwebsockets before making a genuine port
- Host: GitHub
- URL: https://github.com/neradoc/websockets-for-circuitpython
- Owner: Neradoc
- License: mit
- Created: 2020-12-26T03:02:24.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-05-25T16:34:37.000Z (about 2 years ago)
- Last Synced: 2025-03-30T20:51:09.717Z (3 months ago)
- Language: Python
- Size: 122 KB
- Stars: 30
- Watchers: 4
- Forks: 7
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Websockets For Circuitpython
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*.
### Universal Sockets branch for ESP32S2 and Airlift
- Create a `websockets.Session` with:
- **socket** the socket module.
- **ssl=** the `ssl_context` for S2 (optional).
- **iface=** the `ESP_SPIcontrol` interface object (optional).
- `with session.client(url) as ws`
- Connect as a client and return the WebSockets object.
- Url is `ws://server:port` or `wss://server:port`
- Use `ws.send` and `ws.recv` to exchange data with the server.
- Uses a UniversalSocket abstraction class to encapsulate the differences.
- `uwebsockets` client 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/uwebsocketsSPDX-FileCopyrightText: Copyright (c) 2022 Neradoc
SPDX-License-Identifier: MIT