Permalink
Browse files

Merge pull request #25 from dkoneill/master

Fixed the nickname usage, ordering of parameters to emit_to_room() and improper echo to the sender
  • Loading branch information...
2 parents 08cfbf6 + 732ec52 commit 3f5e94e15c996cba3792175e7633609c7c96085e @abourget committed May 7, 2012
Showing with 4 additions and 4 deletions.
  1. +3 −3 examples/chat.py
  2. +1 −1 socketio/mixins.py
View
@@ -9,14 +9,14 @@
class ChatNamespace(BaseNamespace, RoomsMixin, BroadcastMixin):
def on_nickname(self, nickname):
self.environ['nicknames'].append(nickname)
- #self.socket.session = nickname
- self.broadcast_event('anouncement', '%s has connected' % nickname)
+ self.socket.session['nickname'] = nickname
+ self.broadcast_event('announcement', '%s has connected' % nickname)
self.broadcast_event('nicknames', self.environ['nicknames'])
# Just have them join a default-named room
self.join('main_room')
def on_user_message(self, msg):
- self.emit_to_room('msg_to_room', msg, 'main_room')
+ self.emit_to_room('main_room', 'msg_to_room', self.socket.session['nickname'], msg)
def recv_message(self, message):
print "PING!!!", message
View
@@ -33,7 +33,7 @@ def emit_to_room(self, room, event, *args):
for sessid, socket in self.socket.server.sockets.iteritems():
if 'rooms' not in socket.session:
continue
- if room_name in socket.session['rooms']:
+ if room_name in socket.session['rooms'] and self.socket != socket:
socket.send_packet(pkt)

0 comments on commit 3f5e94e

Please sign in to comment.