Summary:
This diff ensures that all operations on the socket are put into a serial background queue, including delegate callbacks.
All operations are executed asynchronously except disconnect, which is made synchronous as to guarantee no resources are accessed after the call.
Reviewed By: fabiomassimo
Differential Revision: D35254499
fbshipit-source-id: 33d93926f7bfc8948095c59f12ca31f0a932b8ae
Summary:
From a different diff, it was pointed out that calling methods on self are discouraged:
Generally you want to avoid calling methods on self in dealloc because it allows you to accidentally capture references to self in dealloc, which leads to zombies.
In this case, a disconnect effectively invalidates a timer and disconnect the underlying socket. Both take place either way when the members are deallocated too. The only thing is not done is notify the caller via the event handler of a close event.
In our case, the caller actually manually disconnects before deallocating so this is not an issue.
Reviewed By: fabiomassimo
Differential Revision: D35547600
fbshipit-source-id: 9b5b9892b657a69585943613bc81344b38dbef30
Summary:
^
Changelog: Check if there's a process listening at the specified port before attempting to establish a websocket connection on iOS
Reviewed By: fabiomassimo
Differential Revision: D35546817
fbshipit-source-id: 92ccca9afd8bcdc6d79205cc277ac813e0999166
Summary: When building for Mac Catalyst, it mostly appears as if it's targeting iOS (`TARGET_OS_OSX` is `0`) and the behavior should be aligned with iOS Simulator builds.
Reviewed By: lblasa
Differential Revision: D34413681
fbshipit-source-id: 1e56bbb3f16f8cd78e77771ff641c5cfcbc49955
Summary:
^
Note: this is already a working case. The difference is that if we are unable to establish a socket connection, we will not attempt to create one using rsocket.
Changelog: Removes rsocket-fallback for mobile clients
Reviewed By: nikoant
Differential Revision: D33655430
fbshipit-source-id: cb6f752f2d1354ab46d011b1f19c89520e1e7dd3
Summary: Achieving API parity with C++ and Android.
Reviewed By: lblasa
Differential Revision: D31921830
fbshipit-source-id: 873901107fc3c53166fa7bbaaff65ebdb0e53c2a
Summary:
This change moves the existing serialiser from FlipperWebSocket to FlipperURLSerializer.
The serialiser can be shared with Android as it no longer has any iOS dependencies.
Reviewed By: fabiomassimo
Differential Revision: D31571272
fbshipit-source-id: 0769b384d4143d7404fcfcf993d49dc1b00eeffd
Summary: This change adds a function to base64 encode. It is used to encode the CSR which gets added to the connection url.
Reviewed By: passy
Differential Revision: D31570706
fbshipit-source-id: 8356550fe87ae3ac6aae8616744a9339cf69b511
Summary:
This change removes ourselves as a delegate before closing.
SocketRocket uses its own internal async queue to perform most operations.
After a disconnect, we don't expect to receive any more delegate calls as the handlers may contain references which may have become invalid.
So, removing ourselves as delegates will ensure that we don't get called after a disconnect.
For sanity, we are also taking a copy of the message handler instead of a reference to it.
Reviewed By: briantkelley
Differential Revision: D31360721
fbshipit-source-id: bae5a2423757cd9064ffac28afb8b78c28a20d87
Summary:
Trigger a manual disconnect on deallocation. This was done automatically for us when the underlying socket gets released. But, this gives a bit more visibility and control onto exactly when this is going to take place.
Additionally, do not clear the message handler when a message is received.
It is not required as sendExpectResponse is one time called only used for certificate exchange. If this takes place again, a new handler will be set anyway.
Reviewed By: passy
Differential Revision: D31231828
fbshipit-source-id: 36ad13564a358b88d1618e94195fe05433d80993
Summary:
Addresses an issue with the connect and disconnect sequence.
Both, connect and disconnect should be performed 'synchronously' instead of being queued in the connection event thread.
Events should be queued in the connection event thread instead.
Reviewed By: passy
Differential Revision: D31195525
fbshipit-source-id: c15487ea163dd277dacee0e5669944ac6971355f
Summary:
This change makes WebSockets the default for Flipper on iOS.
Having said that, we are introducing some logic to deal with clients connecting to older Flipper Desktop versions.
The mobile client will first attempt to connect via WebSocket with the Desktop. This connection can either be secure or insecure. If that fails, it will attempt to connect via RSocket.
Connection failure logic:
The mobile client will attempt to connect up-to 3 times via a WebSocket. If it fails to connect, then the socket provider is switched to RSocket.
As before, the mobile client will attempt to connect up-to 3 times via a RSocket. If it fails to connect, then the socket provider is switched back to WebSocket.
Process repeats until a successful connection is established.
Some logs that can be seen from iOS:
2021-09-15 14:31:51.193503+0100 Sample[92026:92107440] [] nw_protocol_get_quic_image_block_invoke dlopen libquic failed
2021-09-15 14:31:51.878257+0100 Sample[92026:92107440] [connection] nw_socket_handle_socket_event [C1.1:1] Socket SO_ERROR [61: Connection refused]
2021-09-15 14:31:52.553729+0100 Sample[92026:92107440] [connection] nw_socket_handle_socket_event [C1.2:1] Socket SO_ERROR [61: Connection refused]
2021-09-15 14:31:52.899511+0100 Sample[92026:92107442] [connection] nw_connection_get_connected_socket [C1] Client called nw_connection_get_connected_socket on unconnected nw_connection
2021-09-15 14:31:52.899664+0100 Sample[92026:92107442] TCP Conn 0x600001d384d0 Failed : error 0:61 [61]
2021-09-15 14:31:57.120120+0100 Sample[92026:92107439] [connection] nw_socket_handle_socket_event [C2.1:1] Socket SO_ERROR [61: Connection refused]
2021-09-15 14:31:57.141785+0100 Sample[92026:92107439] [connection] nw_socket_handle_socket_event [C2.2:1] Socket SO_ERROR [61: Connection refused]
2021-09-15 14:31:57.151604+0100 Sample[92026:92107483] [connection] nw_connection_get_connected_socket [C2] Client called nw_connection_get_connected_socket on unconnected nw_connection
2021-09-15 14:31:57.154312+0100 Sample[92026:92107483] TCP Conn 0x600001d7c0b0 Failed : error 0:61 [61]
2021-09-15 14:31:59.206079+0100 Sample[92026:92107483] [connection] nw_socket_handle_socket_event [C3.1:1] Socket SO_ERROR [61: Connection refused]
2021-09-15 14:31:59.236824+0100 Sample[92026:92107483] [connection] nw_socket_handle_socket_event [C3.2:1] Socket SO_ERROR [61: Connection refused]
2021-09-15 14:31:59.251927+0100 Sample[92026:92107439] [connection] nw_connection_get_connected_socket [C3] Client called nw_connection_get_connected_socket on unconnected nw_connection
2021-09-15 14:31:59.255963+0100 Sample[92026:92107439] TCP Conn 0x600001d1c210 Failed : error 0:61 [61]
2021-09-15 14:32:01.291303+0100 Sample[92026:92107439] [connection] nw_socket_handle_socket_event [C4.1:1] Socket SO_ERROR [61: Connection refused]
2021-09-15 14:32:01.312406+0100 Sample[92026:92107439] [connection] nw_socket_handle_socket_event [C4.2:1] Socket SO_ERROR [61: Connection refused]
2021-09-15 14:32:01.323099+0100 Sample[92026:92107483] [connection] nw_connection_get_connected_socket [C4] Client called nw_connection_get_connected_socket on unconnected nw_connection
2021-09-15 14:32:01.326028+0100 Sample[92026:92107483] TCP Conn 0x600001d7c0b0 Failed : error 0:61 [61]
flipper: Failed to connect with the current socket provider
flipper: Use legacy socket provider
flipper: FlipperClient::onConnected
Reviewed By: passy
Differential Revision: D30900471
fbshipit-source-id: 7c242ad71306803b050d0174fc22696bb74fdba5
Summary:
The changes below add the notion of alternative ports to Flipper.
These alternative ports are meant to and will be used to connect via WebSocket instead of RSocket. The name does not suggest that as to make as generic as possible so that they can be reused for different purposes in the future.
Reviewed By: passy
Differential Revision: D30898874
fbshipit-source-id: 5eed8c61b41b502c859192aaac59c284b7b36228
Summary: This change reverts a revert. The change was reverted for 'unrelated' issues addressed on this diff dependencies.
Reviewed By: passy
Differential Revision: D30696113
fbshipit-source-id: 8591d6ea79999597024c316e9927a346979e5219
Summary:
This allows us to configure a simulator to use a non-default port pair by using the `defaults` mechanism. For instance, this can be done by running
```
xcrun simctl spawn booted defaults write "Apple Global Domain" "com.facebook.flipper.ports" -string "9088,9089"
```
Reviewed By: lblasa, timur-valiev
Differential Revision: D30731874
fbshipit-source-id: 689d60b1c392f36dceef1b3c3cfa0c88f54a7a82
Summary: Revert D30371791 (cac09d14aa) to address undefined symbols for a few sandcastle jobs
Reviewed By: fabiomassimo
Differential Revision: D30606610
fbshipit-source-id: 24a5c08bcf5456a96469650a4207b05970399181
Summary:
Contains the implementation of FlipperWebSocket with any necessary changes to use it but without switching it on.
About SocketRocket and Cocoapods
A decision had to be made about whether to define different sub-specs, one for RSocket and another for SocketRocket.
I've opted to keep the podspec as is because:
- Keeps pod consumption as is.
- Makes easier to switch implementations using GK.
- There's no intention to keep RSocket going into the future. So, there's no point in creating a sub-spec only to remove it in the future.
- SocketRocket is a relatively small library so is not contributing to a significant increase in binary size.
If, as reviewer, you consider a subspec makes more sense, then feel free to reach out to discuss.
Reviewed By: fabiomassimo
Differential Revision: D30371791
fbshipit-source-id: 225c5b1de76aff1a6e36640a41765b963aaa2796
Summary: This adds macOS compatibility to Flipper client along with some of the standard plugins.
Reviewed By: jknoxville
Differential Revision: D24644439
fbshipit-source-id: dc15636a6ac1bf684fa1c89735f51f0e97667b62
Summary:
This diff adds a toggle setting in wilde which will enable certificate exchange through www.
Right now it just sends the information about which medium to be used for cert exchange to Flipper JS and its client side. But its implementation is not done yet.
### Flow for Wilde
Whenever user changes the setting(or when user logs out) we set the state of exchange medium and accordingly set/reset authtoken. Note at no given point we remove already existing certificates.
### Context for OSS
With this diff we introduce another way to do certificate exchange. Before this diff, we did certificate exchange by accessing the file system of app. But it turns out it's not possible to do that in applications signed by enterprise certs. Thus with this diff one can write their FlipperKitCertificateProvider and fetch the certificate from WWW.
Reviewed By: jknoxville
Differential Revision: D22896320
fbshipit-source-id: 55aef7028a62e71ba9c02f9f79acaab41d09c0c6
Summary:
This diff fixes the warnings raised from FlipperKit. Also this diff updates the deployement target of FlipperKit to iOS 10. Even wilde assumes the min deployment OS version to be iOS 10. In layout plugin we use [UIAccessibiltyTraiTabBar](https://developer.apple.com/documentation/uikit/uiaccessibility/uiaccessibilitytraits/1648592-tabbar), which assumes iOS 10 and above.
Partially fixes https://github.com/facebook/flipper/issues/803
Still there are some warnings which are coming from the dependencies outside of Flipper.
Reviewed By: passy
Differential Revision: D19941558
fbshipit-source-id: 31809fedb9aa297bc318b5af72e29e8444f0142f
Summary:
This diff runs CLANGFORMAT lint on FlipperKit. I have added CLANGFORMAT as the lint engined for objc files in xplat/sonar. Right now the iOS folder is not formatted according to CLANGFORMAT.
Ran `arc lint -a --paths-cmd "find ./iOS/FlipperKit -type f" --verbose`
Reviewed By: passy
Differential Revision: D19942170
fbshipit-source-id: af677323af4edb761f61f8f7e289cab743aa31f2
Summary: uncrustify was not recommended to add in xplat thus I have added clangformat for xplat/sonar/iOS
Reviewed By: zertosh
Differential Revision: D19879977
fbshipit-source-id: 76f6dadf5d55a61a5342802cfde2821cbff38525
Summary:
Implement the react-native-flipper native module on iOS. Uses very similar abstractions as on Android.
## Changelog
[react-native-flipper] Support iOS
Pull Request resolved: https://github.com/facebook/flipper/pull/795
Test Plan:
Tested using the RN TicTacToe example app
{F228406333}
Reviewed By: mweststrate
Differential Revision: D19853017
Pulled By: priteshrnandgaonkar
fbshipit-source-id: d93d35ff984b9ba75f812c4c8e3c82e4d550f0c0
Summary: Removes the symlink files and copies the actual files. The OSS build is broken as its not able to access those files.It used to work before as the ship it config used to sync thos files from fbobjc. But that approach is fragile as it broke our OSS build recently, because of this diff D16829348
Reviewed By: jknoxville
Differential Revision: D16891051
fbshipit-source-id: b5146129adc8628d336fbca5936539d2e1131ba2
Summary: This target was bloating. Split it in two. Migrate to autotests.
Reviewed By: joshleibsly
Differential Revision: D16829348
fbshipit-source-id: 17f2a10371293ddb850c4556abeecee99a9d7bef
Summary: T46426056: Add utility to convert nlohmann::json to NSDictionary. Use same in instagram logging module.
Differential Revision: D16798341
fbshipit-source-id: 88923fcbcd1ffbed5a468cee4ba2f9482ba81a97
Summary:
`/*` is the standard throughout open source code. For example, Firefox uses single /*: https://hg.mozilla.org/mozilla-central/file/21d22b2f541258d3d1cf96c7ba5ad73e96e616b5/gfx/ipc/CompositorWidgetVsyncObserver.cpp#l3
In addition, Rust considers `/**` to be a doc comment (similar to Javadoc) and having such a comment at the beginning of the file causes `rustc` to barf.
Note that some JavaScript tooling requires `/**`. This is OK since JavaScript files were not covered by the linter in the first place, but it would be good to have that tooling fixed too.
Reviewed By: zertosh
Differential Revision: D15640366
fbshipit-source-id: b4ed4599071516364d6109720750d6a43304c089
Summary: Add the affiliates bit that the linter is checking for.
Reviewed By: jknoxville
Differential Revision: D15164826
fbshipit-source-id: 500ffe89ec0c2fd3acfbc374408d16a337cecfa4
Summary: Only usable with a desktop app that supports physical iOS devices, which isn't released yet.
Reviewed By: passy
Differential Revision: D14132413
fbshipit-source-id: 376d1db06e46ae06346974f2acc95c3d2ff6825d
Summary: Changes FlipperPerformBlockOnMainThread to take a responder, and respond with an error if an exception is caught.
Reviewed By: passy
Differential Revision: D14066982
fbshipit-source-id: 70135bf58171684bcd013c66d9deec366aed36f5
Summary:
Flipper exposes a call() api to plugins which lets them call their sdk component, and it returns a promise with the response.
Currently this is done by sending a fireAndForget request, noting the id of the request, and then receiving fireAndForget requests and matching up the ids to give the result back to the right plugin promise.
Instead, it will be simpler to use rsocket requestResponse, instead of fireAndForget, which is for this exact use case. This diff adds a requestResponse handler to the SDK, so that it can deal with such requests and respond accordingly, while preserving the current functionality if it receives a fireAndForget.
So this part is backwards compatible and should be safe to land in isolation.
A later diff will change the desktop app to use requestResponse, which may not be backwards compatible, so that will have to be deployed more carefully.
Reviewed By: passy
Differential Revision: D13974049
fbshipit-source-id: b371d94a86b1f186375161ed8f2242a462ce418f
Summary:
Another smaller diff was responsible for breaking the build... D14019510 would have been the fix, which is integrated into this diff anyway.
---
Renaming FBMacros.h to FBDefines.h for more standard naming (similar to say UIKit/UIKit.h or Foundation/Foundation.h).
```
Tools/fastmod/fastmod --accept-all '\bFBMacros.h' FBDefines.h ../xplat
```
drop-conflicts
bypass-lint
allow-large-files
Reviewed By: dinhviethoa
Differential Revision: D14019529
fbshipit-source-id: 940490a5ec72ccdeb819598f488dc22eae454a26
Summary:
Renaming FBMacros.h to FBDefines.h for more standard naming (similar to say UIKit/UIKit.h or Foundation/Foundation.h).
```
Tools/fastmod/fastmod --accept-all '\bFBMacros.h' FBDefines.h ../xplat
```
drop-conflicts
bypass-lint
allow-large-files
Reviewed By: adamjernst
Differential Revision: D14011897
fbshipit-source-id: f1dd7e686eef2cdb109e85c2db4a0f2ac3d0ba42
Summary:
Part 2 of changing flipper to use customizable ports: iOS SDK.
Still to go: JS app.
env var should be of the format:
`FLIPPER_PORTS=1111,2222` for insecure port: 1111 and secure port: 2222.
Reviewed By: danielbuechele
Differential Revision: D13800988
fbshipit-source-id: 3560ba850389964f4b784551b803c45c6524e6f0
Summary:
Disabling the port fordwarder.
On physical devices, when flipper isn't running and they don't have any certificates, they attempt to connect to the desktop.
They always connect to the portforwarder, even though it doesn't connect to flipper desktop.
After connecting to the portforwarder, they then try to generate the SSL certs. This is a CPU intensive operation and happens repeatedly in this condition when it really shouldn't be, causing high cpu usage.
Disabling for now. The fix will be to make sure that they only do that generation when they are fully connected.
Reviewed By: priteshrnandgaonkar
Differential Revision: D13507353
fbshipit-source-id: a858a5da7352228b063150334ea443130763d888
Summary: Adds support for physical iOS devices, when the necessary dependencies are present. Unfortunately these aren't open sourced yet so the open source build won't get this feature yet.
Reviewed By: priteshrnandgaonkar
Differential Revision: D13001473
fbshipit-source-id: d8c2bcd53b7972bec676717c8af0112800b918d0
Summary:
See FBPortForwarding/README.md for an explanation of what this is.
It's required for the upcoming support for physical iOS devices.
To simplify development of the JS app, We're going to bundle the pre-built PortForwardingMacApp
inside the repo, and inside the electron app (static/PortForwardingMacApp.app).
Adding this source so users can build it from source if they choose to.
Reviewed By: danielbuechele
Differential Revision: D13276022
fbshipit-source-id: 99b18e0412cf443bb4a67eb4846cc780e0014de1
Summary:
This diff adds few tests for flipper client on iOS side. This tests are similar to the ones which exists in xplat but this tests the iOS side of flipper client.
Following tests are added
- connect , disconnect block called on plugin
- background plugin activated before init method
- crash getting suppressed
Reviewed By: jknoxville
Differential Revision: D13167637
fbshipit-source-id: 6c21d5cf2f08e7e3c17ecacbf3badfbde80fb5d1