以下问题。我正在尝试处理发送到我的客户的数据。我大约有100个开放订阅,它们几乎同时发送不同的数据到我的客户端,但是我需要一次处理它们。我该怎么办?
const ws = new WebSocket('wss:/xyz.com');
// Add a listener that will be triggered when the WebSocket is ready to use
ws.addEventListener('open', () => {
console.log('Sending a request to the Server:', sendData);
// Send the message to the WebSocket server
ws.send(sendData);
});
// Add a listener in order to process WebSocket messages received from the server
ws.addEventListener('message', event => {
let t1 = performance.now()
//Using Zlib to decompress the responses
zlib.unzip(event.data, (err, buffer) => {
fetchData(buffer)
let t2 = performance.now()
console.log(t2-t1);
})
});
现在
fetchData()
我经常收到邮件,甚至无法完成邮件,但我需要一一处理。我不知道该怎么做。
预先感谢:)