1.7.3.22 SYS_WSS_sendMessage Function

C

SYS_WSS_RESULT SYS_WSS_sendMessage(bool fin, SYS_WSS_FRAME type, uint8_t *data, size_t dataLen, int32_t clientIndex)

Summary

Sends a message to the client indicated by the parameter clientIndex.

Description

This API sends the data provided in the web socket frame format 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
finFin value as defined by RFC6455 to indicate if the frame is final or continuation frame. 0 = Indicates more messages to follow, the current frame is a continuation frame 1 = Indicates the final frame of the message
typeThe data type of the frame , TEXT or BINARY
*dataA pointer to buffer with the data to be sent
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_sendMessage(1, SYS_WSS_FRAME_TEXT, ((SYS_WSS_RXDATA*) data)->data, ((SYS_WSS_RXDATA *) data)->datalen, clientIndex);

Remarks

None.