Executing Server Code

Once you deploy your server code in Kii Cloud, it will be executed according to settings configured in the server hook configuration file.

  • Executing manually

    You can execute server code from the client SDK. See Manually Executing Server Code to learn more.

    When you manually execute server code, a DEBUG level event will be recorded in the developer log. You can check the log with the command line tool. See Inspect Developer Log to learn more.

  • Executing with a trigger-based hook

    Server code will be executed according to triggers set in the server hook configuration file. Server code is executed "at least once", so it could be executed multiple times.

    No log will be recorded in the developer log when server code is executed by the trigger-based hook. If you want to record some custom messages, for instance for debugging, you can explicitly record them in your code. See Developer Log to learn more.

  • Executing with a schedule-based hook

    Server code will be executed at the designated time set in the server hook configuration file.

    You can check the result of the executions with the command line tool. The tool will give you a list of executions based on schedules. See Checking Results of Schedule-based Hooks to learn more.

  • Executing with a Thing-IF trigger

    Server code can be also executed automatically by setting a Thing-IF trigger. Read the following topics to learn more: Android, iOS, JavaScript, REST API.

Unlike a client application, you cannot show an error message when an error occurs in server code. When designing your server code, be careful to ensure data consistency and consider about error recovery process as needed. You can also implement your server code so as to later recover the process manually with the help of the developer log.