def cleanup():
     """
     Sends the on_finish signal to any open clients when the server
     is unexpectedly stopped.
     """
     for (request, socket, context) in CLIENTS.values():
         events.on_finish.send(request, socket, context)
Exemplo n.º 2
0
def broadcast(message):
    """
    Find the first socket and use it to broadcast to all sockets
    including the socket itself.
    """
    try:
        socket = CLIENTS.values()[0][1]
    except IndexError:
        raise NoSocket("There are no clients.")
    socket.send_and_broadcast(message)
Exemplo n.º 3
0
def broadcast(message):
    """
    Find the first socket and use it to broadcast to all sockets
    including the socket itself.
    """
    try:
        socket = CLIENTS.values()[0][1]
    except IndexError:
        raise NoSocket("There are no clients.")
    socket.send_and_broadcast(message)