This topic describes more features that Fun provides for developing serverless applications in Link IoT Edge.

Develop and debug a continuous function

Function Compute supports continuous functions in Link IoT Edge. You can use Fun to develop and debug continuous functions in the same way as developing and debugging functions that run on demand. Specifically, you can use Fun to create a continuous function based on specific event content and run the invoke command to call and debug the function.

Develop a driver

The driver is a serverless application built based on continuous functions. You can also use Fun to develop and debug a driver. When you associate a driver with a device in the IoT Platform console, the IoT Platform console generates the driver configuration and delivers the configuration to the corresponding edge instance. The driver configuration does not exist in the local mock Link IoT Edge environment on your computer unless you add it. To make the local mock Link IoT Edge environment run as expected on your computer, add the driver configuration in the following format to the driver code on your computer:
  "thingInfos": [
      "productKey": "string",
      "deviceName": "string",
      "custom": {}

The productKey and deviceName parameters in the configuration specify the product key and identifier of the device associated with the driver.

The following section provides the sample code of a driver, where the const config parameter specifies the driver configuration:
const config = {
  thingInfos: [
      productKey: "string",
      deviceName: "string",
      custom: {}
const thingInfos = config.thingInfos;
thingInfos.forEach((thingInfo) => {
  const light = new Light();
  // The thingInfo format is just right for connector config, pass it directly.
  const connector = new Connector(thingInfo, light);
Note After developing and debugging a driver on your computer, you must call the Config.get() operation to obtain the driver configuration and replace the content in the const config parameter in the driver code with the obtained driver configuration. Then you can pack the driver and upload the generated package to the IoT Platform console. For more information about the Config.get() operation, see Device connection SDK.

Deploy a driver

You cannot directly deploy a driver to Function Compute. To deploy the driver, you must pack the driver and upload the generated package to the IoT Platform console. To pack a driver, run the following command in the root directory of the driver project:
zip -r <Your Project Name>.zip *
Note The file defining the entry point of the driver must be in the top-level directory in the .zip package of the driver.

To upload the driver package, log on to the IoT Platform console and choose Link IoT Edge > Drivers in the left-side navigation pane. On the Drivers page that appears, click the Custom Drivers tab and create a driver. Upload the driver package when creating the driver. Then you can use the driver in Link IoT Edge.