Can i point the websocket payload to another memory location ?
Posted: Tue Aug 19, 2025 11:53 pm
Question about ws_echo_server example in http_server directory
The websocket packet payload is a uint8_t* and memory is allocated to store the request payload.
In the example the response uses in the same address for the payload.
I need to use more memory for the response but if I assign another address which points to the response I want to send
the payload doesn't accept it.
The payload address is the original address assigned to it.
The websocket packet payload is a uint8_t* and memory is allocated to store the request payload.
In the example the response uses in the same address for the payload.
I need to use more memory for the response but if I assign another address which points to the response I want to send
the payload doesn't accept it.
The payload address is the original address assigned to it.
Code: Select all
if ((ws_pkt.type == HTTPD_WS_TYPE_TEXT) && (strstr((char *)ws_pkt.payload, "quick") != 0))
{
ws_pkt.payload = (uint8_t *)response; //DOESN'T CHANGE THE PAYLOAD ADDRESS
ESP_LOGI(TAG, "payload pointer: %p response pointer: %p", &ws_pkt.payload, response);
ret = httpd_ws_send_frame(req, &ws_pkt);
}