Merge branch 'bugfix/ws_user_context' into 'master'

websocket: added missing event data

Closes IDF-1271

See merge request espressif/esp-idf!7059
This commit is contained in:
Angus Gratton 2020-01-03 09:29:41 +08:00
commit 4132923ebe
2 changed files with 9 additions and 16 deletions

View file

@ -107,6 +107,10 @@ static esp_err_t esp_websocket_client_dispatch_event(esp_websocket_client_handle
{
esp_err_t err;
esp_websocket_event_data_t event_data;
event_data.client = client;
event_data.user_context = client->config->user_context;
event_data.data_ptr = data;
event_data.data_len = data_len;
event_data.op_code = client->last_opcode;

View file

@ -47,9 +47,11 @@ typedef enum {
* @brief Websocket event data
*/
typedef struct {
const char *data_ptr; /*!< Data pointer */
int data_len; /*!< Data length */
uint8_t op_code; /*!< Received opcode */
const char *data_ptr; /*!< Data pointer */
int data_len; /*!< Data length */
uint8_t op_code; /*!< Received opcode */
esp_websocket_client_handle_t client; /*!< esp_websocket_client_handle_t context */
void *user_context; /*!< user_data context, from esp_websocket_client_config_t user_data */
} esp_websocket_event_data_t;
/**
@ -61,19 +63,6 @@ typedef enum {
WEBSOCKET_TRANSPORT_OVER_SSL, /*!< Transport over ssl */
} esp_websocket_transport_t;
/**
* @brief Websocket Client events data
*/
typedef struct {
esp_websocket_event_id_t event_id; /*!< event_id, to know the cause of the event */
esp_websocket_client_handle_t client; /*!< esp_websocket_client_handle_t context */
void *user_context;/*!< user_data context, from esp_websocket_client_config_t user_data */
char *data; /*!< data of the event */
int data_len; /*!< length of data */
} esp_websocket_event_t;
typedef esp_websocket_event_t* esp_websocket_event_handle_t;
/**
* @brief Websocket client setup configuration
*/