Coder Social home page Coder Social logo

Comments (8)

lws-team avatar lws-team commented on July 21, 2024

There is actually stuff in the esp32-related plugins where the device itself will go out in client mode and look for newer firmware from a remote server. I checked this basically worked when I wrote it, but I haven't tested it in a while.

https://github.com/warmcat/libwebsockets/blob/master/plugins/protocol_esp32_lws_scan.c#L216
https://github.com/warmcat/libwebsockets/blob/master/plugins/protocol_esp32_lws_scan.c#L1136

If you define these things

Var example
CONFIG_LWS_MODEL_NAME "bfg9000"
CONFIG_LWS_OTA_SERVER_BASE_URL "/url-base-on-server", eg, "/updates"
CONFIG_LWS_OTA_SERVER_FQDN "myserver.com"

It will check for, eg

https://myserver.com/updates/bfg9000/manifest.json

This is the same file generated during build in ./build. If it wants it, it will download .../bfg9000/projectname.bin, again from ./build.

at startup when it gets internet in factory mode. It gets projectname.bin from the existing firmware's manifest.

from lws-esp32-factory.

nodi-andy avatar nodi-andy commented on July 21, 2024

do you think i can convert these HTTP POST Requests:

LWS_CALLBACK_HTTP_BODY
LWS_CALLBACK_HTTP_BODY_COMPLETION

to WebSocket requests and change POST Request parsing to websocket parsing.

This can be the way?

Downloading a file is good but think about the opportunity that a factory can send userapp to another factory via websocket. This sound very interessting and i can just use my server with websocketd to send userapp.bin

would you prefer that i should use libwebsocket with c++ in ubuntu server to transmit userapp or ready-to-use websocketd application?

I would appreciate if you give hints about my concept because i think this kind of a concept has a good future.

thanks

from lws-esp32-factory.

nodi-andy avatar nodi-andy commented on July 21, 2024

i found out, that you handle http and ws protocoll in same routine?? That makes the things easier,

Is there a format that i can start ws.send(....) and the data goes into esp_ota_begin, ota_write and ota_end??

from lws-esp32-factory.

lws-team avatar lws-team commented on July 21, 2024

You can have it also support wss, but overall, isn't it easier to do it with https, and copy the files somewhere that any http server can serve them? Ws doesn't really buy you anything afaik.

from lws-esp32-factory.

nodi-andy avatar nodi-andy commented on July 21, 2024

how do you download a file?
And if you download, than you have to read and call esp_ota_begin , write, end anyway. But i am also OK with this solution, just think that it is the same complicity.

Can you give me a hint or i will try to route ws data to esp_ota_begin etc...

from lws-esp32-factory.

lws-team avatar lws-team commented on July 21, 2024

https://github.com/warmcat/libwebsockets/blob/master/plugins/protocol_esp32_lws_scan.c#L216
https://github.com/warmcat/libwebsockets/blob/master/plugins/protocol_esp32_lws_scan.c#L1136

from lws-esp32-factory.

nodi-andy avatar nodi-andy commented on July 21, 2024

ok, i've solved. It is the best practice to change server data from sdkconfig

from lws-esp32-factory.

lws-team avatar lws-team commented on July 21, 2024

It does let you control it from sdkconfig

CONFIG_LWS_OTA_SERVER_FQDN="libwebsockets.org"
CONFIG_LWS_OTA_SERVER_BASE_URL="/esp32-ota"
CONFIG_LWS_OTA_SERVER_UPLOAD_USER="root"
CONFIG_LWS_OTA_SERVER_UPLOAD_PATH="/var/www/libwebsockets.org"

Btw there is a make target make upload that lets you scp the current project binary to the remote server along with the manifest, using the SERVER_UPLOAD_USER / _PATH vars.

from lws-esp32-factory.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.