title: Why do I need to await for a coroutine?
body: <p>I am starting with websockets and <code>asyncio</code> and have a hard time understanding the logic behind. I used threading on Python in the past as well as AJAX calls on Javascript (so I have an idea of the concept of multiple threads (I/O bound) and calls to procedures which results are acted upon asynchronously).</p>
  
  <p>The example server is below. My aim is to provide a websocket connection and two functions which will be called every 10 seconds, without waiting for the results (so exactly one call every 10 seconds, no matter how long it takes for the functions to process).</p>
  
  <pre><code>import time
  import arrow
  import websockets
  import asyncio
  
  async def time1(websocket):
      # simulation of a time intensive operation
      time.sleep(2)
      msg = '1 ' + arrow.now()
      print(msg)
      websocket.send(msg)
  
  async def time2(websocket):
      # simulation of a time intensive operation
      time.sleep(3)
      msg = '2 ' + arrow.now()
      print(msg)
      websocket.send(msg)
  
  async def update_info(websocket, path):
      while True:
          now = arrow.now()
          if not now.second % 10:
              time1(websocket)
          if not now.second % 10:
              time2(websocket)
  
          time.sleep(1)
  
  start_server = websockets.serve(update_info, 'localhost', 5678)
  asyncio.get_event_loop().run_until_complete(start_server)
  asyncio.get_event_loop().run_forever()
  </code></pre>
  
  <p>I expected to get, once the client connected, on the next full 10 seconds, the functions fired. They would complete after 2 and 3 seconds, then be fired on the next full 10 seconds etc.</p>
  
  <p>What I got instead was</p>
  
  <pre><code>D:/Dropbox/dev/domotique/webserver.py:708: RuntimeWarning: coroutine 'time1' was never awaited
    time1(websocket)
  D:/Dropbox/dev/domotique/webserver.py:710: RuntimeWarning: coroutine 'time2' was never awaited
    time2(websocket)
  </code></pre>
  
  <p>and none of the messages were either sent or printed.</p>
  
  <p>Why do I have to <code>await</code> for the coroutines? I would like to fire them up form <code>update_info</code> and forget about them (= leave them to their processing and let them send the data via the websocket). <strong>What is wrong with my approach?</strong></p>