1.7.3.23 SYS_WSS_CloseConnection Function

C

SYS_WSS_RESULT SYS_WSS_CloseConnection(SYS_WSS_STATUS_CODE code, uint8_t *data, size_t dataLen, int32_t clientIndex)

Summary

Closes the Web Socket connection to the client indicated by the parameter clientIndex.

Description

This API initiate the closing handshake with the status code provided and and terminate the Web Socket connection to the client indicated by the parameter clientIndex.

Precondition

The connection state of the client indicated by the clientIndex (g_wssSrvcObj.wssState) shall be SYS_WSS_STATE_CONNECTED

Parameters

ParamDescription
codeStatus code to be send to the client in the closing handshake(SYS_WSS_STATUS_CODE) .
*dataA pointer to buffer with the data (if any) related to the connection closure
dataLenLength of the data
clientIndexThe clientID, for identifying the client which caused the event to occur.

Returns

SYS_WSS_RESULT.

Example

SYS_WSS_RESULT res;
res =SYS_WSS_CloseConnection(SYS_WSS_STATUS_CODE_UNSUPPORTED_DATA, NULL, 0, 1);

Remarks

None.