Hello @marcidy
Well, first congratulations for the great project. I'm starting to use it and I liked so much.
1. How is possible to add Content-Type on the header? Actually all Content-Type response is text/html I would like to add the correct Content-Type to each static file type.
Actually I'm doing this routes on file web.py:
routes = {
b'/': route('/www/page.htm'),
b'/static/jquery.js': route('/www/jquery-3.5.1.min.js'),
b'/static/img1.jpg': route('/www/image1.jpg'),
b'/static/img2.jpg': route('/www/image2.jpg'),
b'/static/bootstrap.css': route('/www/bootstrap.min.css'),
b'/static/favicon.ico': route('/www/favicon.ico')
}
That routes works fine, but if I reach address http://192.168.43.143/static/img1.jpg will not show the image, just the binary data, because Content-Type is text/html
2. Just a simple bugfix in the doc: In the https://github.com/marcidy/micropython-uasyncio-webexample#phone-home say: "change phone_home in ws.py" but the function name is call_home instead phone_home.
3. My goal is to have just one static page, like as the example page.htm, and to do everything in just one page, using JavaScript + HTML, and communicate with the ESP32-S3 running MicroPython, just using WebSocket, to send and receive data. Well, the question is: do you think that is a good idea to put all interface in just one page? I mean, will be a large page, because I will to do many tabs, many configurations fields, and will have a tab just for monitoring data from sensors, where will receive data from MicroPython when a event happen there, and of course, without request, just waiting a event on WebSocket that will run as a persistent connection. That is what I really want, I would like just to know if that is a really a good idea.
4. Actually I tested your WebSocket example on Firefox, Chromium, Chrome and Opera, and works very well in everyone. My fear is if I develop a complete application web using WebSocket and in the future (in new versions of browsers) my WebSocket application stop to work. Is there that possibility?
5. I would like so much that in the future is possible to use the WebSocket over SSL, like as this feature request #2. So, for now, I will to do everything using your project, without SSL, and when uasyncio start to support SSL (as you commented in #2), I think that you will need do do just few changes in this project to support SSL on WebSocket. Is that correct, or will be need big changes in this project to support that?
Thank you in advance!
Hello @marcidy
Well, first congratulations for the great project. I'm starting to use it and I liked so much.
1. How is possible to add
Content-Typeon the header? Actually allContent-Typeresponse istext/htmlI would like to add the correctContent-Typeto each static file type.Actually I'm doing this routes on file
web.py:That routes works fine, but if I reach address http://192.168.43.143/static/img1.jpg will not show the image, just the binary data, because
Content-Typeistext/html2. Just a simple bugfix in the doc: In the https://github.com/marcidy/micropython-uasyncio-webexample#phone-home say: "change
phone_homeinws.py" but the function name iscall_homeinsteadphone_home.3. My goal is to have just one static page, like as the example
page.htm, and to do everything in just one page, usingJavaScript+HTML, and communicate with the ESP32-S3 runningMicroPython, just usingWebSocket, to send and receive data. Well, the question is: do you think that is a good idea to put all interface in just one page? I mean, will be a large page, because I will to do many tabs, many configurations fields, and will have a tab just for monitoring data from sensors, where will receive data fromMicroPythonwhen a event happen there, and of course, without request, just waiting a event onWebSocketthat will run as a persistent connection. That is what I really want, I would like just to know if that is a really a good idea.4. Actually I tested your
WebSocketexample on Firefox, Chromium, Chrome and Opera, and works very well in everyone. My fear is if I develop a complete application web usingWebSocketand in the future (in new versions of browsers) myWebSocketapplication stop to work. Is there that possibility?5. I would like so much that in the future is possible to use the
WebSocketoverSSL, like as this feature request #2. So, for now, I will to do everything using your project, withoutSSL, and whenuasynciostart to supportSSL(as you commented in #2), I think that you will need do do just few changes in this project to supportSSLonWebSocket. Is that correct, or will be need big changes in this project to support that?Thank you in advance!