OnWebSocketMessage

OnWebSocketMessage 1:

This method must not be called by the user. Instead, you can derive from the function block FB_IotWebSocketsClient and override this method. While the Execute() method is called, the responsible TwinCAT driver can call the OnWebSocketMessage() method in the event of new incoming messages. In the event of several incoming messages the callback method is called several times, once per message. This must be taken into account when the method is implemented.

METHOD OnWebSocketMessage: HRESULT
VAR_INPUT
    content              : PVOID;
    contentLength        : UDINT;
    contentType          : ETcIotWebSocketContentType;
END_VAR

OnWebSocketMessage 2: Return value

Name

Type

Description

OnWebSocketMessage

HRESULT

The return value of the method should be S_OK, if the message was accepted. If the message is to be issued again in the context of the next Execute() call, the return value can be assigned S_FALSE.

OnWebSocketMessage 3: Inputs

Name

Type

Description

content

PVOID

Pointer to the content.

contentLength

UDINT

Size of the content in bytes.

contentType

ETcIotWebSocketContentType

Specifies whether the content is binary or text.