2009-11-25 Yuzo Fujishima <yuzo@google.com>
[WebKit-https.git] / WebKitTools / pywebsocket / example / echo_wsh.py
index f680fa5cd17b95ea2fa1d55ba6d62c0b560ab513..50cad3184d45c5317efd5eb115f43aa490512f04 100644 (file)
@@ -31,6 +31,9 @@
 from mod_pywebsocket import msgutil
 
 
+_GOODBYE_MESSAGE = 'Goodbye'
+
+
 def web_socket_do_extra_handshake(request):
     pass  # Always accept.
 
@@ -39,6 +42,8 @@ def web_socket_transfer_data(request):
     while True:
         line = msgutil.receive_message(request)
         msgutil.send_message(request, line)
+        if line == _GOODBYE_MESSAGE:
+            return
 
 
 # vi:sts=4 sw=4 et