- Code: Select all
('ws://10.0.1.123:8176/v2/api/ws/device-feed') --> ('ws://10.0.1.123:8176/v2/api/ws/log-feed')
Save the code to a file called "whatever.html" and -- using a plain text editor -- change the URL to point to your Indigo Server IP (10.0.1.123:8176, 127.0.0.1:8176, or localhost:8176), and open it with a browser.
- Code: Select all
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script>
device_feed = new WebSocket('ws://10.0.1.123:8176/v2/api/ws/device-feed');
device_feed.onopen = (event) => {
console.log('socket open');
// let command = {
// "message": "indigo.device.toggle",
// "objectId": 12345678,
// };
//
// console.log('sending command');
// device_feed.send(JSON.stringify(command));
};
device_feed.onmessage = (event) => {
console.log("device feed message received");
document.getElementById('output').append(`device feed message received:\n ${event.data}\n\n`);
};
</script>
</head>
<body>
<pre id="output"></pre>
</body>
</html>
<style>
html {
background: rgb(75, 75, 75);
color: white;
}
</style>