On Message TX Data

Called to set a chunk of the WebSocket message payload to the connection buffer.

Prototype

          CPU_INT32U  HTTPc_WebSockOnMsgTxData (HTTPc_CONN_OBJ            *p_conn,
                                                HTTPc_WEBSOCK_MSG_OBJ     *p_msg,
                                                CPU_CHAR                  *p_buf,
                                                CPU_INT32U                 buf_len);

Arguments

p_conn

Pointer to the current HTTPc Connection Object.

p_msg

Pointer to the WebSocket message object.

p_buf

Pointer to the start of the transmit buffer. 

buf_len

The available size of the transmit buffer.

Return Values

Number of bytes copied in the buffer and ready to be transmitted.

Required Configuration

Notes / Warnings

  • In dynamic mode, thus the message length has been previously set to HTTPc_WEBSOCK_TX_MSG_LEN_NOT_DEFINED, this hook will be called until the value 0 is returned.  
  • This hook is set in a HTTPc_WEBSOCK_MSG_OBJ using HTTPc_WebSockMsgSetParam() with the parameter HTTPc_PARAM_TYPE_WEBSOCK_MSG_ON_MSG_TX_INIT.
  • Must be set to the HTTPc_WEBSOCK_MSG_OBJ before upgrading the connection with HTTPc_WebSockSend.