{"size": 1009, "ext": "js", "max_stars_repo_path": "js/ws.js", "max_stars_repo_name": "tomoya06/cpchain-demo", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "js/ws.js", "max_issues_repo_name": "tomoya06/cpchain-demo", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "js/ws.js", "max_forks_repo_name": "tomoya06/cpchain-demo", "max_forks_repo_forks_event_min_datetime": "2019-01-10T05:45:13.000Z", "max_forks_repo_forks_event_max_datetime": "2019-01-10T05:45:13.000Z"}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": 1, "avg_line_length": 37.3703703704, "max_line_length": 121, "alphanum_fraction": 0.5044598612}
(function() {
    var ws = new WebSocket('ws://127.0.0.1:8080')
    
    ws.onopen = function() {
        console.log('open')
    }
    
    ws.onmessage = function(evt) {
        console.log(evt)
        var msg = JSON.parse(evt.data)
        console.log(msg);
        if (msg.from === 'ctrl') {
            // TODO: Use Reveal.slide(number) to switch to a particular slide. Index starts from 0. 
            // TODO: msg.data is the control signal. Must be the same to the message sent directly from your iot device 
            // (or, if being edited via editSerialData() function in serial.js in the server project, the edited one. )
            switch (msg.data) {
                case '1': Reveal.slide(1); break;
                case '2': Reveal.slide(2); break;
                case '3': Reveal.slide(3); break;
                case '4': Reveal.slide(4); break;
                case '0': Reveal.slide(0); break;
                default: ;
            }
        }
    }
})()
