{% extends "layout.html" %}
{% block title %}{{title}}{% endblock %}
{% block head %}
    <script type="text/javascript" src="//code.jquery.com/jquery-1.4.2.min.js"></script>
    <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/socket.io/0.9.16/socket.io.min.js"></script>
    <script type="text/javascript" charset="utf-8">
        $(document).ready(function(){
            namespace = ''; // change to an empty string to use the global namespace

            // the socket.io documentation recommends sending an explicit package upon connection
            // this is specially important when using the global namespace
            var socket = io.connect('http://' + document.domain + ':' + location.port + namespace);
            socket.on('connect', function() {
                console.log("connect");
                socket.emit('my event', {data: 'I\'m connected!'});
            });

            // event handler for server sent data
            // the data is displayed in the "Received" section of the page
            socket.on('bts.blockchain.info', function(msg) {
                document.getElementById('height').innerHTML = msg.height;
            });

        });
    </script>
  {{ super() }}
{% endblock %}
{% block page %}{{title}}{% endblock %}
{% block heading %}
  {{ super() }}
{% endblock %}
{% block content %}
  <br>
  <h4>balance: <text id='balance'>{{ balance }}</text></h4>
{% endblock %}

