2

I'm working on a project where I need multiple devices to connect to a shared server that can exchange data in realtime. I was approaching this problem by creating a websocket server on a Raspberry Pi 4 which connects to various Raspberry Pi Pico W's that send JSON data at a specific path.

However, trying to actually code the Raspberry Pi Pico W, I quickly found a replacement of "asyncio" for MicroPython, but couldn't find anything for "websockets". These are the libraries I found:

micropython-async_websocket_client is for ESP32 devices

uwebsockets is for ESP8266 devices

I'm installing these packages onto my Raspberry Pi Pico W using Thonny editor but it returns with a non-zero exit status from pip. I could switch to using MQTT with the "micropython-umqtt.simple" package, but I'd prefer websockets.

Is there a solution that could fit my requirements, or do I have to switch to using MQTT?

Mathias
  • 308
  • 1
  • 9
  • Does [this](https://www.donskytech.com/using-websocket-in-micropython-a-practical-example/) help? Alternatively have you tried just copying either of the libraries you linked to on to your Pico W and seeing what errors you get? There might be little if anything you actually need to change for compatibility with the Pico W. – nekomatic Mar 01 '23 at 12:52
  • @nekomatic The article you've linked doesn't seem to help in this situation - I need a WebSocket client, not a server. Your suggested method *might* work, I'll try that. – Mathias Mar 01 '23 at 12:58

0 Answers0