async connect()

in content/device.js [142:178]


            async connect() {
                if (this.saveConfig) {
                    window.localStorage.setItem('connectionInfo',
                        JSON.stringify({
                            scopeId: this.connectionInfo.scopeId,
                            hubName: this.connectionInfo.hubName,
                            deviceId: this.connectionInfo.deviceId,
                            deviceKey: this.connectionInfo.deviceKey,
                            masterKey: this.connectionInfo.masterKey,
                            modelId: this.connectionInfo.modelId
                        }))
                }
                let host = this.connectionInfo.hubName
                if (host.indexOf('.azure-devices.net') === -1) {
                    host += '.azure-devices.net'
                }
                client = new AzIoTHubClient(host,
                    this.connectionInfo.deviceId,
                    this.connectionInfo.deviceKey,
                    this.connectionInfo.modelId)

                client.setDirectMethodCallback(this.processDirectMethods)

                client.setDesiredPropertyCallback(this.processDesiredPropertyPatch)

                client.setCloudToDeviceCallback(this.processCloudToDeviceMessage)

                client.disconnectCallback = (err) => {
                    console.log(err)
                    this.connectionInfo.connected = false
                    this.connectionInfo.status = 'Disconnected'
                }

                await client.connect()
                this.connectionInfo.status = 'Connected'
                this.connectionInfo.connected = true
            },