Enable WebSockets for Android

Summary: This change effectively prioritises WebSocket over RSocket connections for Android.

Reviewed By: passy

Differential Revision: D32490095

fbshipit-source-id: 836438970f0668521ca6e7fab6c106e77f951652
This commit is contained in:
Lorenzo Blasa
2021-12-02 02:23:31 -08:00
committed by Facebook GitHub Bot
parent 3db072557b
commit 6a4a867f74
3 changed files with 2 additions and 11 deletions

View File

@@ -953,9 +953,8 @@ class JFlipperClient : public jni::HybridClass<JFlipperClient> {
securePort, securePort,
altInsecurePort, altInsecurePort,
altSecurePort}); altSecurePort});
// To switch to a WebSocket provider, uncomment the line below. facebook::flipper::FlipperSocketProvider::setDefaultProvider(
// facebook::flipper::FlipperSocketProvider::setDefaultProvider( std::make_unique<JFlipperSocketProvider>());
// std::make_unique<JFlipperSocketProvider>());
} }
private: private:

View File

@@ -31,9 +31,7 @@ static constexpr int reconnectIntervalSeconds = 2;
// To be bumped for every core platform interface change. // To be bumped for every core platform interface change.
static constexpr int sdkVersion = 4; static constexpr int sdkVersion = 4;
#ifdef __APPLE__
static constexpr int maxFailedSocketConnectionAttempts = 3; static constexpr int maxFailedSocketConnectionAttempts = 3;
#endif
using namespace folly; using namespace folly;
@@ -477,7 +475,6 @@ void FlipperConnectionManagerImpl::sendLegacyCertificateRequest(
WebSocket -> RSocket -> WebSocket -> ... WebSocket -> RSocket -> WebSocket -> ...
*/ */
void FlipperConnectionManagerImpl::reevaluateSocketProvider() { void FlipperConnectionManagerImpl::reevaluateSocketProvider() {
#ifdef __APPLE__
if (failedSocketConnectionAttempts < maxFailedSocketConnectionAttempts) { if (failedSocketConnectionAttempts < maxFailedSocketConnectionAttempts) {
++failedSocketConnectionAttempts; ++failedSocketConnectionAttempts;
} else { } else {
@@ -490,7 +487,6 @@ void FlipperConnectionManagerImpl::reevaluateSocketProvider() {
FlipperSocketProvider::unshelveDefault(); FlipperSocketProvider::unshelveDefault();
} }
} }
#endif
} }
bool FlipperConnectionManagerImpl::isRunningInOwnThread() { bool FlipperConnectionManagerImpl::isRunningInOwnThread() {

View File

@@ -75,11 +75,7 @@ class FlipperConnectionManagerImpl : public FlipperConnectionManager {
int failedConnectionAttempts_ = 0; int failedConnectionAttempts_ = 0;
int failedSocketConnectionAttempts = 0; int failedSocketConnectionAttempts = 0;
#ifdef __APPLE__
bool useLegacySocketProvider = false; bool useLegacySocketProvider = false;
#else
bool useLegacySocketProvider = true;
#endif
std::shared_ptr<ConnectionContextStore> contextStore_; std::shared_ptr<ConnectionContextStore> contextStore_;
std::shared_ptr<FlipperConnectionManagerWrapper> implWrapper_; std::shared_ptr<FlipperConnectionManagerWrapper> implWrapper_;