gevent-socketio icon indicating copy to clipboard operation
gevent-socketio copied to clipboard

Change sever.sockets behavior?

Open philipn opened this issue 13 years ago • 2 comments

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 avatar Aug 01 '12 22:08 philipn

@philipn This is a good idea :)

sontek avatar Apr 13 '13 23:04 sontek

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 .

abourget avatar Apr 14 '13 03:04 abourget