Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: secure WebSocket (wss) #2

Open
beyonlo opened this issue Feb 3, 2022 · 4 comments
Open

Feature request: secure WebSocket (wss) #2

beyonlo opened this issue Feb 3, 2022 · 4 comments

Comments

@beyonlo
Copy link

beyonlo commented Feb 3, 2022

Hello!

Do you have intention to support secure WebSocket (use SSL over WebSocket)?

Thank you.

@marcidy
Copy link
Owner

marcidy commented Feb 7, 2022

uasyncio doesn't natively support TLS at the moment, which is annoying. I'd prefer to do the updates when uasycio is updated.

What exactly do you need? a wss client is a lot easier than a wss server, for example. An asyncio wss server is not sufficient for a webrepl, as another example. There's not need for an asyncio websocket for use with webrepl, and upydev has that covered right now if that's what you are looking for.

@beyonlo
Copy link
Author

beyonlo commented Feb 8, 2022

@marcidy Hello!

uasyncio doesn't natively support TLS at the moment, which is annoying. I'd prefer to do the updates when uasycio is updated.

Understood! Is so bad that uasyncio do not support the SSL/TLS :(

What exactly do you need? a wss client is a lot easier than a wss server, for example. An asyncio wss server is not sufficient for a webrepl, as another example. There's not need for an asyncio websocket for use with webrepl, and upydev has that covered right now if that's what you are looking for.

I need an application to ESP32/ESP32-S3 to works as secure HTTPS Server (to serve pages) + secure WebSocket Server (non-blocking socket), both running on uasyncio. So, I can have secure websocket client applications, like as mobile app, desktop app and web app (served by ESP32), all them communicating to ESP32 secure websocket server. I posted in MicroPython page, a time ago, a issue looking for a Simple example of uasyncio WebSocket Server (secure - with SSL) micropython/micropython#8177

I think that most work to support ssl + asyncio / websockets was done, in many PRs, like this PR shows in the latest messages micropython/micropython#5611

Thank you in advance!

@marcidy
Copy link
Owner

marcidy commented Feb 9, 2022

I saw that comment. The issue I see is here:
"I need just to know now how to add uasyncio on that WebREPL + SSL example."

uasyncio is not compatible with WebRepl, it will not "just work". You cannot just take any websocket and any webrepl. The webrepl is a very specific websocket implementation which is included in the micropython firmware, and it's not necessarily compliant with all websockets. However, you definitely do not need asyncio wtih the webrepl, since it works via a callback in the socket, which is why upydev will work for you.

I dont want to sound too negative here, but i dont have confidence you understand what you are asking for. Do you expect the repl to be accessible while something else runs in the background? Asking for the repl is making me think you believe an asyncronous secure websocket is the missing piece to a puzzle but in reality what you need are threads.

@beyonlo
Copy link
Author

beyonlo commented Feb 9, 2022

Hi @marcidy

I saw that comment. The issue I see is here: "I need just to know now how to add uasyncio on that WebREPL + SSL example."

When I open that issue I was thinking that if I have a webrepl example working with uasyncio + ssl, everything will works - my mistake.

uasyncio is not compatible with WebRepl, it will not "just work". You cannot just take any websocket and any webrepl. The webrepl is a very specific websocket implementation which is included in the micropython firmware, and it's not necessarily compliant with all websockets.

Understood. I see that you are not using the uwebsocket (used by webrepl), but you wrote your own websocket protocol. Is it compliant with all websockets?

However, you definitely do not need asyncio wtih the webrepl, since it works via a callback in the socket, which is why upydev will work for you.

Understood. But your example here in this project do not use the callback like as the webrepl, but you are using the real uasyncio, right?

I dont want to sound too negative here, but i dont have confidence you understand what you are asking for. Do you expect the repl to be accessible while something else runs in the background? Asking for the repl is making me think you believe an asyncronous secure websocket is the missing piece to a puzzle but in reality what you need are threads.

I was asking for a webrepl working with uasyncio for a start point to reach, or how to reach if my scenario is possible, not that webrepl is the solution. I just trying to figure out how is possible to do that.

As describe my scenario bellow (application), are you talking about that is NOT possible to do that with uasyncio + non-blocking WebSocket Server (with SSL) + HTTP Server (with ssl) - without use of threads? If answer is YES, please, could you tell me why is necessary to use threads and will not works with uasyncio?

"
I need an application to ESP32/ESP32-S3 to works as secure HTTPS Server (to serve pages) + secure WebSocket Server (non-blocking socket), both running on uasyncio. So, I can have secure websocket client applications, like as mobile app, desktop app and web app (served by ESP32), all them communicating to ESP32 secure websocket server. I posted in MicroPython page, a time ago, a issue looking for a Simple example of uasyncio WebSocket Server (secure - with SSL)
"
Thank you in advance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants