Skip to content

Instantly share code, notes, and snippets.

@bluescreen303
Created August 13, 2011 21:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bluescreen303/1144267 to your computer and use it in GitHub Desktop.
Save bluescreen303/1144267 to your computer and use it in GitHub Desktop.
small bugfix for wschat example in mongrel2 (dev branch)
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