Client:
Status: <div><b id="status">disconnected</b></div>
<pre id="example"></pre>
<script src="/velox.js"></script>
<script>
var foo = {};
var v = velox("/sync", foo);
v.onchange = function(isConnected) {
	document.querySelector("#status").innerHTML = isConnected ? "connected" : "disconnected";
};
v.onupdate = function() {
	document.querySelector("#example").innerHTML = JSON.stringify(foo, null, 2);
};
</script>
Fork me on GitHub
Server:
https://github.com/jpillora/velox/blob/master/example/demo/main.go
Status: disconnected