mg_websocket_client_write( conn, opcode, data, data_len );
|Connection on which to send data|
|The data to be written|
|Length of the data buffer|
|Number of bytes written or an error code|
mg_websocket_client_write() sends data to a websocket server wrapped in a masked websocket frame. The function issues calls to
mg_unlock_connection() to ensure that the transmission is not interrupted. Interruption can happen the the application is proactively communicating and responding to a request simultaneously. This function is available only, if Civetweb is compiled with the option
The return value is the number of bytes written on success, 0 when the connection has been closed and -1 if an error occured.