microsoft / devicescript

TypeScript for Tiny IoT Devices (ESP32, RP2040, ...)
https://microsoft.github.io/devicescript/
MIT License
3.28k stars 118 forks source link

Web server / client support? #414

Closed zackify closed 1 year ago

zackify commented 1 year ago

With the pico w, is there any chance of getting a simple web server like micro python has?

I know there is the local cloud stuff that is being worked on, but I would love being able to make a simple server or make http requests to things.

pelikhan commented 1 year ago

Related to MQTT (https://github.com/microsoft/devicescript/issues/395), supporting different networking setups.

pelikhan commented 1 year ago

We are looking into this for the ESP32.

pelikhan commented 1 year ago

We have added "fetch" and sockets in the latest release (v2.10.*)

zackify commented 1 year ago

Wow that was fast! That’s so awesome thanks

zackify commented 1 year ago

Any way for me to know when this will be in the docs? I didn’t see any notes on release either

pelikhan commented 1 year ago

The docs are not quite there yet but the fetch implementation should give you a good idea of how to use sockets.

https://microsoft.github.io/devicescript/developer/net

pelikhan commented 1 year ago

https://github.com/microsoft/devicescript/blob/main/packages/net/src/fetch.ts

zackify commented 1 year ago

Thanks so much that’s perfect on the client side, just need to learn how I can start a http server next!

Edit: nice I’m reading your socket code. Very helpful