talkAsync()

in editor/wrap.ts [113:132]


    talkAsync(buf: Uint8Array, altResponse = 0) {
        return this.lock.enqueue("talk", () => {
            this.msgs.drain()
            if (this.dataDump)
                log("TALK: " + U.toHex(buf))
            return this.io.sendPacketAsync(buf)
                .then(() => this.msgs.shiftAsync(5000))
                .then(resp => {
                    if (resp[2] != buf[2] || resp[3] != buf[3])
                        U.userError("msg count de-sync")
                    if (buf[4] == 1) {
                        if (altResponse != -1 && resp[5] != buf[5])
                            U.userError("cmd de-sync")
                        if (altResponse != -1 && resp[6] != 0 && resp[6] != altResponse)
                            U.userError("cmd error: " + resp[6])
                    }
                    return resp
                })
        })
    }