Created
August 13, 2011 21:32
-
-
Save bluescreen303/1144267 to your computer and use it in GitHub Desktop.
small bugfix for wschat example in mongrel2 (dev branch)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/examples/wschat/chat.py b/examples/wschat/chat.py | |
index 4054942..be0b9ab 100644 | |
--- a/examples/wschat/chat.py | |
+++ b/examples/wschat/chat.py | |
@@ -110,7 +110,8 @@ while True: | |
continue | |
if data["type"] == "join": | |
- conn.deliver_json(req.sender, users.keys(), data) | |
+ if len(users.keys()) > 0: | |
+ conn.deliver(req.sender, users.keys(), wsframe(json.dumps(data))) | |
users[req.conn_id] = data['user'] | |
user_list = [u[1] for u in users.items()] | |
conn.reply(req, wsframe(json.dumps({'type': 'userList', 'users': user_list}))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment