sockets.py
def read_ws(ws,client):
    '''A greenlet function that reads from the websocket and updates the world'''
    try:
        while True:
            msg = ws.receive()
            # print "WS RECV: %s" % msg
            if (msg is not None):
                packet = json.loads(msg)
                # print "Packet: %s" % packet

                for name, data in packet.iteritems():
                    entity = myWorld.get(name)

                    for k, v in data.iteritems():
                        # Do it this way so we don't call the listener until
                        # all KV pairs have been updated
                        entity[k] = v

                    myWorld.set(name, entity)
            else:
                break
    except:
        pass

    return None
A greenlet function that reads from the websocket and updates the world
A greenlet function that reads from the websocket and updates the world
A greenlet function that reads from the websocket and updates the world
def read_ws(ws,client):
    try:
        while True:
            msg = ws.receive()
            if (msg is not None):
                packet = json.loads(msg)
                for name, data in packet.iteritems():
                    entity = myWorld.get(name)
                    for k, v in data.iteritems():
                        entity[k] = v
                    myWorld.set(name, entity)
            else:
                break
    except:
        pass
    return None
def read_ws ( ws , client ) : try : while True : msg = ws . receive ( ) if ( msg is not None ) : packet = json . loads ( msg ) for name , data in packet . iteritems ( ) : entity = myWorld . get ( name ) for k , v in data . iteritems ( ) : entity [ k ] = v myWorld . set ( name , entity ) else : break except : pass return None
A greenlet function that reads from the websocket and updates the world
A greenlet function that reads from the websocket and updates the world
'''A greenlet function that reads from the websocket and updates the world''' # print "WS RECV: %s" % msg # print "Packet: %s" % packet # Do it this way so we don't call the listener until # all KV pairs have been updated
ws
client