-
The documentation of send method indicates:
When the return value is 0:
I would like to retry the failed messages. Is this below approach correct? I am maintaining a const retryQ= [];
const sendNow = (ws, msg) => {
const status = ws.send(msg, true, true);
switch (status) {
case 1: // sent successfully, nothing to do
return status;
case 2: { // dropped due to backpressure, lets try again later after drain even
retryQ.push(msg);
return status;
}
case 0: { // built-up backpressure: what should be done????
retryQ.push(msg); //<<-- should we retry the message again or has it already been queued at socket?
return status;
}
}
}; |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
case 0: { // built-up backpressure: what should be done???? It is already in backpressure queue ready to send out, you don't need to do anything there. Only need to handle the dropped messages |
Beta Was this translation helpful? Give feedback.
It is already in backpressure queue ready to send out, you don't need to do anything there. Only need to handle the dropped messages