WebSocket server on pico 2040 W?

CircuitPython on hardware including Adafruit's boards, and CircuitPython libraries using Blinka on host computers.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
wonderlove
 
Posts: 2
Joined: Fri May 19, 2023 5:55 am

WebSocket server on pico 2040 W?

Post by wonderlove »

What I would like to do is to stream data between the pico and a browser. The idea here is that I could then treat the websocket somewhat similar to what I do with usb serial, where I send json back and forth and use readline() to separate out the messages.

I've been playing around with the websocket made available in the web workflow, but that seems just to mirror the REPL stream (or is that just sys.sdtout?). What would be the recommended way to read that stream on the device? Can I use it similar to what I do with usb serial or am I way off the mark here?

User avatar
tannewt
 
Posts: 3304
Joined: Thu Oct 06, 2016 8:48 pm

Re: WebSocket server on pico 2040 W?

Post by tannewt »

The webworkflow websocket is one serial stream that is muxed into sys.stdout and sys.stdin. `input()` should work with it. We don't currently have a way to read and write just that serial stream. (Like we do with usb_cdc for USB.)

User avatar
wonderlove
 
Posts: 2
Joined: Fri May 19, 2023 5:55 am

Re: WebSocket server on pico 2040 W?

Post by wonderlove »

Thanks for the clear answer :)

Locked
Please be positive and constructive with your questions and comments.

Return to “Adafruit CircuitPython”