• I had a problem with WebSocket when I try to send a long string(1688 Bytes in my case). I got error
    "Execution Interrupted during event processing.
    New interpreter error: LOW_MEMORY,MEMORY".

    Then I modified the ws module, made the send function can accept a json object, to prevent string copy. But in another for loop, it still make a copy of source, I made comment down below.

    g.prototype.send = function(a, b) {
        let c, f, d, e;
        try {
            if (
                ((c = a.value.length),
                    125 < a.value.length && (c = 126),
                    this.socket.write(
                        h(void 0 === b ? 129 : b, c + (this.masking ? 128 : 0))
                    ),
                    126 == c &&
                    (this.socket.write(h(a.value.length >> 8)),
                        this.socket.write(h(a.value.length))),
                    this.masking)
            ) {
                for (c = [], f = "", d = 0; 4 > d; d++) {
                    (e = Math.floor(255 * Math.random())), (c[d] = e), (f += h(e));
                }
                for (d = 0; d < a.value.length; d++) {
                    //here will make a copy of source
                    f += h(a.value.charCodeAt(d) ^ c[3 & d]);
                }
                print(process.memory());
                this.socket.write(f);
            } else this.socket.write(a);//2
        } catch (e) {
            (c = d = f = e = null), this.initializeConnection();
        }
    }
    

    I tried 5 methods(like using flash as buffer or turn source string in to array at first and exchange char in it in for loop) to fix it ,but none of them work.

    I wish to use the second method to send data, but server will emit error "MASK must be set".

    Anyone know how to deal with this? Thank you.

About

Avatar for user111618 @user111618 started