Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions examples/webclient_en.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
//English commented webclient example
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<script src="http://localhost:8080/socket.io/socket.io.js"></script>
</head>
<body>
Very simplistic and spartan example, that sends a light command when this page is loaded.
</body>
<script>
// Example message based on examples/python.py
var packet = new Uint8Array([
1, // Specification version, always 1
0, // Nick tag
101, // e
112, // p
101, // e
108, // l
105, // i
0, // Nick end

// First effect command
1, // Effect type is 1, a light.
0, // First light fixture at index 0.
0, // Extension byte. Always 0.
255, // Red to maximum value
0, // Green to minimum value
0, // Blue to minimum value

// Another effect command
1, // This effect type is also 1, a light.
1, // Second light fixture at index 1.
0, // Extension byte. Always 0.
// RGB values as previously
0,
255,
0,

// Add as many effect commands as you desire!
]);
var socket = io.connect('http://localhost:8080/');
socket.on('connect', function () {
socket.emit('message', Array.prototype.slice.call(packet));
});
</script>
</html>