Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Matthew Hughson
    @mhughson
    I am trying to run mongoose.exe and windows blocks it saying a virus is detected.
    I've tried both Chrome and Internet Explorer
    novlean
    @novlean
    Matthew please refer to https://mongoose.ws/desktop-app/faq/ where your situation is explained.
    Matthew Hughson
    @mhughson
    im not actually sure how to add an exclusion for a file that can't even be downloaded.
    MaximF39
    @MaximF39
    Как скачать монгус?
    novlean
    @novlean
    Mongoose Desktop executable download -> https://mongoose.ws/desktop-app/ .
    Mongoose Library download -> https://github.com/cesanta/mongoose/releases .
    zhangzj03
    @zhangzj03
    hi,i can't find mg_start_thread function
    Sergey Lyubka
    @cpq
    @zhangzj03 you're using a very outdated version. Please get the latest from github
    d4rkmen
    @d4rkmen
    guys, i have small Q, because the mqtt client example missing wildcard subscription logic
    hi first
    v6 library has ‘mg_mqtt_match_topic_expression’ to match received topic with subscription expr
    how to handle it in v7?
    Sergey Lyubka
    @cpq
    @d4rkmen just to clarify. This question is about MQTT server implementation, is that correct ?
    d4rkmen
    @d4rkmen
    helper functions for mqtt client
    Sergey Lyubka
    @cpq
    That function in 6.x branch was meant for the server. Could you elaborate your anticipated usage by the client please?
    d4rkmen
    @d4rkmen
    sure, look:
    lets say we have multiple topics to subscribe
    cool/foo/bar
    foo/+/bar
    all received messages we have in one place and need to pick a handler for just received mqtt message depending of a topic
    message received topic foo/123/bar
    Sergey Lyubka
    @cpq
    Ah. Understood.
    Just use * instead of +.
    d4rkmen
    @d4rkmen
    this is very cool helper but not in this particular case. another call is now to get the wildcard token 123 from the topic string. helper funcs for these cases would be very nice
    a man can write own helpers offcourse :heavy_check_mark: but to have it included is a pleasure :smile:
    Sergey Lyubka
    @cpq
    Did 6.x helper function extract sub-topics? Can't remember, but I don't think so
    It looks like you're asking for something like this:
      if (mg_globmatch(...)) {
        int id = 0;
        sscanf(mm->topic.ptr, "foo/%d/", &id);
        ...
      } else if (mg_globmatch()) {
        ...
    d4rkmen
    @d4rkmen
    well, i got an answer for my Q, thanks
    getter to add:
    struct mg_str mg_mqtt_topic_component(struct mg_str *topic, int index)
    and return a path component by index, then mg_strcmp
    Sergey Lyubka
    @cpq
    @d4rkmen thanks. But aren't you using Mongoose OS with includes 6.x ?
    d4rkmen
    @d4rkmen
    no, this is my first v7 project :+1:
    d4rkmen
    @d4rkmen
    @cpq
    // * Port from v6
    static struct mg_str mg_mqtt_next_topic_component(struct mg_str* topic) {
        struct mg_str res = *topic;
        const char* c = mg_strstr(*topic, mg_str("/"));
        if (c != NULL) {
            res.len = (c - topic->ptr);
            topic->len -= (res.len + 1);
            topic->ptr += (res.len + 1);
        } else {
            topic->len = 0;
        }
        return res;
    }
    
    // * Port from v6
    int mg_mqtt_match_topic_expression(struct mg_str exp, struct mg_str topic) {
        struct mg_str ec, tc;
        if (exp.len == 0)
            return 0;
        while (1) {
            ec = mg_mqtt_next_topic_component(&exp);
            tc = mg_mqtt_next_topic_component(&topic);
            if (ec.len == 0) {
                if (tc.len != 0)
                    return 0;
                if (exp.len == 0)
                    break;
                continue;
            }
            if (mg_vcmp(&ec, "+") == 0) {
                if (tc.len == 0 && topic.len == 0)
                    return 0;
                continue;
            }
            if (mg_vcmp(&ec, "#") == 0) {
                return (exp.len == 0);
            }
            if (mg_strcmp(ec, tc) != 0) {
                return 0;
            }
        }
        return (tc.len == 0 && topic.len == 0);
    }
    
    // * Exctract MQTT topic level by index
    struct mg_str mg_mqtt_topic_level(struct mg_str topic, int level) {
        struct mg_str tc;
        int i = 0;
        while (1) {
            tc = mg_mqtt_next_topic_component(&topic);
            if (tc.len == 0)
                return mg_str("");
            if (i == level)
                return tc;
            i++;
        }
    }
    my suggestion for this case, thanks.
    d4rkmen
    @d4rkmen
    hi, gyys!
    facing vierd issue with mqtt client: missing messages
    i can reed them on other client witch opened to monitor the flow
    but mongoose missing it. when i resend it again manually - it works ok (QOS 0)
    d4rkmen
    @d4rkmen
    solved, problem was: mongoose subscribed with QOS 1, other client QOS 0
    Sergey Lyubka
    @cpq
    @d4rkmen thanks for clarifying!
    d4rkmen
    @d4rkmen
    actually, thank YOU for this amazing library and the way You maintain it @cpq
    hdmt-hock
    @hdmt-hock

    Good Day, esp8266 build with mos 2.20 ok, but got the following crash at startup

    mgos_wifi_sta.c:608     Trying Hidromotic AP 00:0c:42:d5:0e:d8 ch 9 RSSI -35 cfg 0 att 11
    esp_main.c:137          SDK: scandone
    mgos_wifi_sta.c:635     Connect failed
    esp_main.c:137          SDK: scandone
    mgos_net.c:89           WiFi STA: connecting
    mgos_wifi_sta.c:585     No candidate APs
    esp_main.c:137          SDK: scandone
    mgos_mongoose.c:66      New heap free LWM: 1416
    mgos_mongoose.c:66      New heap free LWM: 1312
    mgos_mongoose.c:66      New heap free LWM: 1296
    mgos_mongoose.c:66      New heap free LWM: 1288
    mgos_mongoose.c:66      New heap free LWM: 1184
    mgos_mongoose.c:66      New heap free LWM: 1168
    mgos_mongoose.c:66      New heap free LWM: 1160
    mgos_mongoose.c:66      New heap free LWM: 1056
    mgos_mongoose.c:66      New heap free LWM: 1040
    mgos_mongoose.c:66      New heap free LWM: 1032
    mgos_mongoose.c:66      New heap free LWM: 928
    mgos_mongoose.c:66      New heap free LWM: 912
    esp_main.c:137          SDK: scandone
    E:M 1872 (235 blocks)
    esp_wifi.c:515          Out of memory
    mgos_mongoose.c:66      New heap free LWM: 888

    Also Why so many mgos_mongoose.c:66 New heap free LWM: at startup?

    With the stack monitor, how much memory can we really use in esp8266 mos 2.20?

    With 2.19, the wifi connection works well.
    hdmt-hock
    @hdmt-hock
    sorry, I moved the above message to mongoose-os room
    ngdream
    @ngdream
    hello
    i'm working on web micro framework with mongoose but i don't know how to send post request
    void Server::start_mg_server(struct mg_connection *c, int ev, void *ev_data, void *fn_data)
    {
        if (ev == MG_EV_HTTP_MSG)
        {
            struct mg_http_message *hm = (struct mg_http_message *)ev_data, tmp = {0};
    
            struct mg_str unknown = mg_str_n("?", 1), *cl;
            std::map<std::string, View *>::iterator i;
            for (i = Url::views_mapping.begin(); i != Url::views_mapping.end(); i++)
            {
                if (mg_http_match_uri(hm, i->first.c_str()))
                {
    
                    Request request;
                    Httpresponse res = i->second->get(request);
                    std::cout << i->first;
                    mg_printf(c, "GET HTTP/1.1 200 OK\r\nContent-Length: %d\r\nContent-Type: %s\r\n\r\n%s\n",
                              res.content().size(), res.contenttype().c_str(), res.content().c_str());
                }
            }
            cl = mg_http_get_header(&tmp, "Content-Length");
            if (cl == NULL)
                cl = &unknown;
    
            /*MG_INFO(("%.*s %.*s %.*s %.*s", (int)hm->method.len, hm->method.ptr,
                     (int)hm->uri.len, hm->uri.ptr, (int)tmp.uri.len, tmp.uri.ptr,
                     (int)cl->len, cl->ptr));*/
        }
    }
    here is the function that launch the server
    ngdream
    @ngdream
    please someone could help me to handle post and get request , i'm french speaking so i 've some difficulties with english tutorial and there is no mongoose's tutorial in french that is why i'm asking for your help please show me a very simple exemple on how to handle post request , and get request ) thanks
    https://github.com/ngdream/bridje here is the repository if you need to see the whole code
    Ghost
    @ghost~5bfb2e3fd73408ce4fb00bda
    Hey everyone, it's been a while, but I'm back!! I have some projects surfacing that MOS is perfect for
    any reason why I can't post in the mongoose-os room?
    netwake-jwr
    @netwake-jwr:talk.netwake.com
    [m]
    can somebody tell me why mongoose wont compile and I get mode_t and time_t are undefined? I can add <time.h> to mongoose.h, but stat.h is not available. Im using freertos and lwip