On Message RX Data

Called every time a chunk of the data message is available to be read.  

Prototype

          CPU_INT32U  HTTPc_WebSockOnMsgRxData  (HTTPc_CONN_OBJ            *p_conn,
                                                 HTTPc_WEBSOCK_MSG_TYPE     msg_type,
                                                 void                      *p_data,
                                                 CPU_INT16U                 data_len);


Arguments

p_conn

Pointer to the current HTTPc Connection Object.

msg_type

Type of WebSocket messge to receive.

p_data

Pointer to the message data chunk.

data_len 

Length of the data chunk available. 

Return Values

The total number of bytes read from the data chunk.

Required Configuration

Notes / Warnings

  • When the number of bytes read is less than the available data, the remaining bytes will be available for the next time this hook is called with new received data concatenated, if applicable.
  • This hook is set in a HTTPc_WEBSOCK_OBJ using HTTPc_WebSockSetParam() with the parameter HTTPc_PARAM_TYPE_WEBSOCK_ON_MSG_RX_DATA.
  • Must be set to the HTTPc_WEBSOCK_OBJ before upgrading the connection with HTTPc_WebSockUpgrade().