Hang on websocket.recv() after... something?
<p>Apologies for the ambiguous question - I actually have no idea what I changed that stopped this from working.</p>

<p>I'm working on a text adventure engine (open source project) in Python using Websockets. <s>This was working fine with the asyncio and websockets modules. I moved things around a bit and now it hangs upon receiving input.</s></p>

<p>I lied - it never worked. This code however, does work:</p>

<pre><code>#!/usr/bin/python3

import asyncio
import websockets
import time

async def hello(websocket, path):
    while True:
        name = await websocket.recv()
        print("&lt; {}".format(name))

        greeting = ''.join(name + "... " for x in range(5))
        await websocket.send(greeting)
        print("&gt; {}".format(greeting))

        time.sleep(0.1);

start_server = websockets.serve(hello, '', 26231)

asyncio.get_event_loop().run_until_complete(start_server)
asyncio.get_event_loop().run_forever()
</code></pre>

<p>My code (the code that doesn't work) is available on the respective GitHub repo:</p>

<p><a href="https://github.com/KernelDeimos/mmota-server/issues/1" rel="nofollow">https://github.com/KernelDeimos/mmota-server/issues/1</a></p>

<p>Later when I have the time I'll add a repository for my client and link that here as well, though it's very basic (no changes were made to the client between the working commit and the broken one).</p>

<p>The client connects to localhost:26231 and sends a message that I type (ex: "echo")</p>

<p>The server sends back the message - or at least, it's supposed to.</p>

<p>Unfortunately, the server hangs on this line of server.py:</p>

<pre><code>data = await self.websocket.recv()
</code></pre>

<p>and the print on the next line is never executed.</p>