def should_send_event(socket, annotation, event_data):
    """
    Inspects the passed annotation and action and decides whether or not
    the underlying session should receive the event. If it should, the
    action is wrapped up in a websocket packet and sent to the client.
    """
    if socket.terminated:
        return False

    if event_data['action'] == 'read':
        return False

    if event_data['src_client_id'] == socket.client_id:
        return False

    if not socket.request.has_permission('read', annotation):
        return False

    # We don't send anything until we have received a filter from the client
    if socket.filter is None:
        return False

    if not socket.filter.match(annotation, event_data['action']):
        return False

    return True