def send_array(
        socket, A=None, metadata=None, flags=0,
        copy=False, track=False, compress=None,
        chunksize=50 * 1000 * 1000
):
    md = {}
    md['timestamp'] = datetime.datetime.now().isoformat()
    if metadata:
        md.update(metadata)
    if A is None:
        md['parts'] = 0
        socket.send_json(md, flags)
        return
    if isinstance(A, float) or isinstance(A, int):
        A = np.asarray(A)
    md['dtype'] = str(A.dtype)
    md['shape'] = A.shape
    md['parts'] = int(np.prod(A.shape) // chunksize + 1)
    try:
        md['fill_value'] = np.asscalar(A.fill_value)
        A = A.filled()
    except AttributeError:
        pass
    socket.send_json(md, flags | zmq.SNDMORE)
    if md['parts'] == 1:
        msg = memoryview(np.ascontiguousarray(A))
        socket.send(msg, flags, copy=copy, track=track)
    else:
        for i, a in enumerate(np.array_split(A, md['parts'])):
            msg = memoryview(np.ascontiguousarray(a))
            flags_ = flags
            if i != md['parts'] - 1:
                flags_ |= zmq.SNDMORE
            socket.send(msg, flags_, copy=copy, track=track)
    return