(I think I gave you this bug in my answer to your previous question, sorry.)
The line in authenticate_user_async
where it calls f
needs to be changed. Change this:
f(self, *args, **kwargs)
To this:
yield f(self, *args, **kwargs)
Now swap the order of decoration for on_message
:
@authenticate_user_async
@gen.coroutine
def on_message(self, data):
In authenticate_user_async
, "f" is your on_message
. These two fixes ensure that "f" is a coroutine and that it gets run to completion.