src/mongoose/mongoose.cpp
int mg_set_protocol_coap(struct mg_connection *nc) {
    /* supports UDP only */
    if ((nc->flags & MG_F_UDP) == 0) {
        return -1;
    }

    nc->proto_handler = coap_handler;

    return 0;
}
/*
 * Attach built-in CoAP event handler to the given connection.
 *
 * The user-defined event handler will receive following extra events:
 *
 * - MG_EV_COAP_CON
 * - MG_EV_COAP_NOC
 * - MG_EV_COAP_ACK
 * - MG_EV_COAP_RST
 */
Attach built-in CoAP event handler to the given connection.
The user-defined event handler will receive following extra events.


Attach built - in CoAP event handler to the given connection . The user - defined event handler will receive following extra events .
int mg_set_protocol_coap(struct mg_connection *nc) {
    if ((nc->flags & MG_F_UDP) == 0) {
        return -1;
    }
    nc->proto_handler = coap_handler;
    return 0;
}
int mg_set_protocol_coap ( struct mg_connection * nc ) { if ( ( nc -> flags & MG_F_UDP ) == 0 ) { return -1 ; } nc -> proto_handler = coap_handler ; return 0 ; }
Attach built-in CoAP event handler to the given connection.
Attach built - in CoAP event handler to the given connection .
/* supports UDP only */