getDeviceList() hangs indefinitely.
Hi, I am trying to use the getDeviceList snippet from
here, in the plugin example code but that method never appears to return.
- const { core, ServiceModule } = require("@tago-io/tcore-sdk");
- const express = require('express');
- const app = express();
- let server = null;
- const service = new ServiceModule({
- id: "getting-started-service",
- name: "Getting Started Service",
- configs: [
- {
- type: "number",
- field: "port",
- name: "Port",
- required: true,
- }
- ],
- });
- service.onLoad = async (userValues) => {
- if (!userValues.port) {
- throw new Error("Invalid port");
- }
- app.get('/', (req, res) => {
- res.send('Hello World')
- });
- server = app.listen(userValues.port);
- getDeviceList();
- };
- async function getDeviceList() {
- try {
- console.log("Before getDeviceList()");
- const list = await core.getDeviceList();
- console.log("Retrieved", list.length, "devices");
- } catch {
- (error) => { console.log(error) };
- }
- service.onDestroy = () => {
- server.close();
- };
- }
I see the "Before getDeviceList()" log message but never the "Retreived" message.
I did add the Device permission in the manifest.
Am I missing something?
Cheers,
Erwin