Do not reject promise for sendExpectResponse invokations

Summary:
On Flipper Desktop, rawCall uses sendExpectResponse from the client connection.
RSocket only rejects the promise if there's an error in the transport layer and thus is unable to send data over the wire.

WebSocket sends without errors as errors will always be reported via a different callback api.

Having said that, WebSocket client connections were rejecting the promise for a valid client response that contained an error instead of success, which in this specific case is expected.

The solution is to always resolve the promise with the response and let the Client interpret the response accordingly.

Changelog: Fixes an issue whereas client errors were erroneously disconnecting a client from the Desktop side

Reviewed By: aigoncharov

Differential Revision: D32983969

fbshipit-source-id: 4215d9234235a9e2035b1d743c317ebdf2f656a2
This commit is contained in:
Lorenzo Blasa
2021-12-09 06:09:22 -08:00
committed by Facebook GitHub Bot
parent 4c6643f019
commit 59641d7987

View File

@@ -89,8 +89,6 @@ class SecureServerWebSocket extends ServerWebSocket {
if (!callbacks) { if (!callbacks) {
return; return;
} }
if (parsedMessage.success !== undefined) {
callbacks.resolve({ callbacks.resolve({
...parsedMessage, ...parsedMessage,
length: rawMessage.length, length: rawMessage.length,
@@ -98,10 +96,6 @@ class SecureServerWebSocket extends ServerWebSocket {
return; return;
} }
callbacks.reject(parsedMessage.error);
return;
}
// Received an "execute" message // Received an "execute" message
if (client) { if (client) {