How to use the @iobroker/adapter-react/Connection function in @iobroker/adapter-react

To help you get started, we’ve selected a few @iobroker/adapter-react examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ioBroker / ioBroker.javascript / src / src / App.js View on Github external
logHorzLayout: window.localStorage ? window.localStorage.getItem('App.logHorzLayout') === 'true' : false,
            runningInstances: {},
            confirm: '',
            importFile: false,
            message: '',
            searchText: '',
            themeType: window.localStorage ? window.localStorage.getItem('App.theme') || 'light' : 'light',
        };
        // this.logIndex = 0;
        this.logSize = window.localStorage ? parseFloat(window.localStorage.getItem('App.logSize')) || 150 : 150;
        this.menuSize = window.localStorage ? parseFloat(window.localStorage.getItem('App.menuSize')) || 500 : 500;
        this.scripts = {};
        this.hosts = [];
        this.importFile = null;

        this.socket = new Connection({
            autoSubscribes: ['script.*', 'system.adapter.javascript.*'],
            autoSubscribeLog: true,
            onProgress: progress => {
                if (progress === PROGRESS.CONNECTING) {
                    this.setState({connected: false});
                } else if (progress === PROGRESS.READY) {
                    this.setState({connected: true, progress: 100});
                } else {
                    this.setState({connected: true, progress: Math.round(PROGRESS.READY / progress * 100)});
                }
            },
            onReady: (objects, scripts) => {
                I18n.setLanguage(this.socket.systemLang);
                window.systemLang = this.socket.systemLang;
                this.onObjectChange(objects, scripts, true);
            },