window.addEventListener('load', () => {
  let pushedbox = document.getElementById('pushedteam');
  let form = document.getElementById('form');
  let ws = new WebSocket('ws://' + window.location.host + '/websocket');

  ws.onopen = () => console.log('connection opened');
  ws.onclose = () => console.log('connection closed');
  ws.onmessage = m => {
    if (m.data=="Delete!") {
      while (pushedbox.firstChild) pushedbox.removeChild(pushedbox.firstChild);
      document.getElementById('push').disabled = false;
    } else {
      let li = document.createElement('li');
      li.textContent = m.data;
      pushedbox.append(li);
    };
  };
