Closed GoogleCodeExporter closed 9 years ago
receive_message returns None only when closing handshake was successful. Any
other abnormal closures result in exception. E.g. in the case you mentioned to
reproduce this it's actually raising ConnectionTerminatedException.
Original comment by tyoshino@chromium.org
on 7 Dec 2011 at 4:49
I am using version 0.6b5 and no exception is thrown on the handler thread. Is
the exception getting thrown on the main thread? Were the exceptions added in
one of the later versions?
I need receive_message() to return either with None or an exception when the
client disconnects, regardless of if it was with a closing handshake or
abnormal.
Original comment by dunca...@gmail.com
on 7 Dec 2011 at 3:21
I checked that by enclosing while loop in example/echo_wsh.py with try-except.
I.e. handler thread.
It works with 0.6b5 release.
import msgutil
...
try:
while True:
line = request.ws_stream.receive_message()
if line is None:
# Successful closing handshake
# Normal processing
except msgutil.ConnectionTerminatedException, e:
# Connection closed unexpectedly
Original comment by tyoshino@chromium.org
on 8 Dec 2011 at 2:42
You are correct, the exception is being thrown. Looks like without the
try/catch block, the exception is silently thrown, as there is no output to the
console.
Looks like there isn't a problem with recieve_message(), thanks for all your
help. You can close this issue.
Original comment by dunca...@gmail.com
on 8 Dec 2011 at 3:12
OK. We'll fix pydoc for receive_message method to list Exceptions it throws and
explain them. Thanks.
Original comment by tyoshino@chromium.org
on 12 Dec 2011 at 5:08
Original issue reported on code.google.com by
dunca...@gmail.com
on 23 Sep 2011 at 3:22