gevent-socketio
gevent-socketio copied to clipboard
Change sever.sockets behavior?
I'm wondering if it would be better to make server.sockets an iterable of Socket objects (rather than a dict of sessid: sockets) and move the current server.sockets to server._sockets. This would clean up some code:
def broadcast_msg(server, tweet):
for socket in server.sockets.values():
if '/tweets' in socket:
socket['/tweets'].emit('tweet', tweet)
becomes
def broadcast_msg(server, tweet):
for socket in server.sockets:
if '/tweets' in socket:
socket['/tweets'].emit('tweet', tweet)
@philipn This is a good idea :)
Good idea indeed. Let's make sure it's marked clearly in a "Breaking changes" section of the changelogs.
Alexandre
On Sat, Apr 13, 2013 at 7:18 PM, John Anderson [email protected]:
@philipn https://github.com/philipn This is a good idea :)
— Reply to this email directly or view it on GitHubhttps://github.com/abourget/gevent-socketio/issues/71#issuecomment-16342785 .