Login

The login command enables a user to log in to the TwinCAT HMI server and is sent to the server as a WebSocket request in JSON format. If the authentication data is valid, the server allows the login and calls the start page of the HMI.
The WebSocket request must be structured as follows:

var message = {
   "requestType": "ReadWrite",
      "commands": [
         {
            "commandOptions": ["SendErrorMessage", "SendWriteValue"],
            "symbol": "Login",
            "writeValue":
            {
               "userName": username,
               "password": password,
               "persistent": stayLoggedIn
            }
         }
      ]
   };

In the template you will find this WebSocket request in the function "Login" in line 350.

The base functionality of the requests to the server contained in the template should not be changed in order to ensure proper functioning of the login page.