Remove RSocket documentation references
Summary: ^ Changelog: Remove RSocket documentation references Reviewed By: jknoxville Differential Revision: D34345316 fbshipit-source-id: 5b9fac8c04e325f3f02ef3713b0146b17e694c9d
This commit is contained in:
committed by
Facebook GitHub Bot
parent
4d1d9648f0
commit
395708348d
@@ -1,5 +1,5 @@
|
|||||||
# flipper-server-core
|
# flipper-server-core
|
||||||
|
|
||||||
Package that manages connections with flipper clients, queries for adb/idb clients, accepts incoming websocket / rsocket connections and takes care of certificate exchange.
|
Package that manages connections with flipper clients, queries for adb/idb clients, accepts incoming websocket connections and takes care of certificate exchange.
|
||||||
|
|
||||||
Used by Flipper desktop, flipper-server and flipper-dump
|
Used by Flipper desktop, flipper-server and flipper-dump
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ sidebar_label: Using different ports
|
|||||||
|
|
||||||
## FLIPPER ports (mobile apps that support certificate exchange)
|
## FLIPPER ports (mobile apps that support certificate exchange)
|
||||||
|
|
||||||
By default Flipper runs its servers on ports 8088 and 8089, and the mobile SDKs look for servers on those ports.
|
By default Flipper runs its servers on ports 9088 and 9089, and the mobile SDKs look for servers on those ports.
|
||||||
|
|
||||||
Each of these can be overridden by setting an environment variable, with the format `${INSECURE_PORT},${SECURE_PORT}`.
|
Each of these can be overridden by setting an environment variable, with the format `${INSECURE_PORT},${SECURE_PORT}`.
|
||||||
|
|
||||||
|
|||||||
@@ -11,11 +11,11 @@ The connection process is a little more involved than you might expect, to stop
|
|||||||
|
|
||||||
## Transport Protocol
|
## Transport Protocol
|
||||||
|
|
||||||
Flipper uses [RSocket](http://rsocket.io/) to communicate between the desktop and mobile apps. RSocket allows for bi-directional communication.
|
Flipper uses [WebSocket](https://datatracker.ietf.org/doc/html/rfc6455) to communicate between the desktop and mobile apps. WebSocket allows for bi-directional communication.
|
||||||
|
|
||||||
## Client-Server relationship
|
## Client-Server relationship
|
||||||
|
|
||||||
When the desktop app starts up, it opens a secure socket on port 8088.
|
When the desktop app starts up, it opens a secure socket on port 9088.
|
||||||
The Flipper client will continually attempt to connect to this port on localhost to establish a connection with the desktop app.
|
The Flipper client will continually attempt to connect to this port on localhost to establish a connection with the desktop app.
|
||||||
|
|
||||||
## Certificate Exchange
|
## Certificate Exchange
|
||||||
@@ -24,8 +24,8 @@ To avoid mobile apps from connecting to untrusted ports on localhost, a Flipper
|
|||||||
In order for the mobile app to know which certificates it can trust, it conducts a certificate exchange with the desktop app before it can make its first secure connection.
|
In order for the mobile app to know which certificates it can trust, it conducts a certificate exchange with the desktop app before it can make its first secure connection.
|
||||||
|
|
||||||
This is achieved through the following steps:
|
This is achieved through the following steps:
|
||||||
* Desktop app starts an insecure server on port 8089.
|
* Desktop app starts an insecure server on port 9089.
|
||||||
* Mobile app connects to localhost:8089 and sends a Certificate Signing Request to the desktop app.
|
* Mobile app connects to localhost:9089 and sends a Certificate Signing Request to the desktop app.
|
||||||
* Desktop app uses its private key (this is generated once and stored in ~/.flipper) to sign a client certificate for the mobile app.
|
* Desktop app uses its private key (this is generated once and stored in ~/.flipper) to sign a client certificate for the mobile app.
|
||||||
* Along with the Certificate Signing Request, mobile app also lets the desktop app know which certificate exchange medium to use.
|
* Along with the Certificate Signing Request, mobile app also lets the desktop app know which certificate exchange medium to use.
|
||||||
* If the chosen Certificate Exchange Medium is FS_ACCESS, the desktop uses ADB (for Android), or the mounted file system (for iOS simulators) to write the following files to the mobile app's private data partition
|
* If the chosen Certificate Exchange Medium is FS_ACCESS, the desktop uses ADB (for Android), or the mounted file system (for iOS simulators) to write the following files to the mobile app's private data partition
|
||||||
@@ -40,11 +40,11 @@ This allows the mobile app to trust a certificate if and only if, it is stored i
|
|||||||
|
|
||||||
To get the desktop app to generate a client certificate for your client, and then deploy it, go through the following steps:
|
To get the desktop app to generate a client certificate for your client, and then deploy it, go through the following steps:
|
||||||
|
|
||||||
Use an RSocket client to connect (insecurely) to the following URL:
|
Use a WebSocket client to connect (insecurely) to the following URL:
|
||||||
|
|
||||||
(Parameters are defined in [Implementing a Flipper Client](new-clients.mdx))
|
(Parameters are defined in [Implementing a Flipper Client](new-clients.mdx))
|
||||||
```
|
```
|
||||||
localhost:8089/sonar?os={OS}
|
localhost:9089/sonar?os={OS}
|
||||||
&device={DEVICE}
|
&device={DEVICE}
|
||||||
&app={APP}
|
&app={APP}
|
||||||
&sdk_version={SDK_VERSION}
|
&sdk_version={SDK_VERSION}
|
||||||
|
|||||||
@@ -5,21 +5,21 @@ title: Implementing a Flipper Client
|
|||||||
|
|
||||||
In the GitHub repo, you'll find Flipper clients for Android, iOS and C++ code, but there's nothing to stop you from writing a FlipperClient for another device or OS.
|
In the GitHub repo, you'll find Flipper clients for Android, iOS and C++ code, but there's nothing to stop you from writing a FlipperClient for another device or OS.
|
||||||
|
|
||||||
Flipper clients communicate with the Flipper desktop app using JSON RPC messages over an [RSocket](http://rsocket.io/) connection.
|
Flipper clients communicate with the Flipper desktop app using JSON RPC messages over a [WebSocket](https://datatracker.ietf.org/doc/html/rfc6455) connection.
|
||||||
|
|
||||||
This page documents the API, and you can use [FlipperConnectionManagerImpl.cpp](https://github.com/facebook/flipper/blob/main/xplat/Flipper/FlipperConnectionManagerImpl.cpp) for reference.
|
This page documents the API, and you can use [FlipperConnectionManagerImpl.cpp](https://github.com/facebook/flipper/blob/main/xplat/Flipper/FlipperConnectionManagerImpl.cpp) for reference.
|
||||||
|
|
||||||
## Establishing a connection
|
## Establishing a connection
|
||||||
Start by connecting to the Flipper server running within the desktop app. Connecting to the server registers your application with Flipper and enables plugins to interact with it. As the Flipper desktop has a different lifecycle than your app and may connect and disconnect at any time it is important that you attempt to reconnect to the Flipper server until it accepts your connection.
|
Start by connecting to the Flipper server running within the desktop app. Connecting to the server registers your application with Flipper and enables plugins to interact with it. As the Flipper desktop has a different lifecycle than your app and may connect and disconnect at any time it is important that you attempt to reconnect to the Flipper server until it accepts your connection.
|
||||||
|
|
||||||
We use the RSocket protocol for communication between desktop and client, because it allows for easy certificate pinning and functionality like request-response messages.
|
We use the WebSocket protocol for communication between desktop and client, because it allows for easy certificate pinning and functionality like request-response messages.
|
||||||
|
|
||||||
In order to securely connect to Flipper, your client should first [obtain a certificate](establishing-a-connection.mdx).
|
In order to securely connect to Flipper, your client should first [obtain a certificate](establishing-a-connection.mdx).
|
||||||
|
|
||||||
After the client certificate has been obtained, connect to the following URL with an RSocket client:
|
After the client certificate has been obtained, connect to the following URL with a WebSocket client:
|
||||||
|
|
||||||
```
|
```
|
||||||
localhost:8088/sonar?os={OS}
|
localhost:9088/sonar?os={OS}
|
||||||
&device={DEVICE}
|
&device={DEVICE}
|
||||||
&device_id={DEVICE_ID}
|
&device_id={DEVICE_ID}
|
||||||
&app={APP}
|
&app={APP}
|
||||||
@@ -99,7 +99,7 @@ Request = {
|
|||||||
```
|
```
|
||||||
|
|
||||||
### deinit
|
### deinit
|
||||||
Opposite of init. A call to deinit is made when a plugin is no longer needed and should release any resources. Don't rely only on deinit to release plugin resources as Flipper may quit without having the chance to issue a deinit call. In those cases, you should also rely on the RSocket disconnect callbacks. This call is mainly for allowing the desktop app to control the lifecycle of plugins.
|
Opposite of init. A call to deinit is made when a plugin is no longer needed and should release any resources. Don't rely only on deinit to release plugin resources as Flipper may quit without having the chance to issue a deinit call. In those cases, you should also rely on the WebSocket disconnect callbacks. This call is mainly for allowing the desktop app to control the lifecycle of plugins.
|
||||||
```js
|
```js
|
||||||
Request = {
|
Request = {
|
||||||
"method": "deinit",
|
"method": "deinit",
|
||||||
@@ -148,7 +148,7 @@ Request = {
|
|||||||
While in development mode, Flipper will display any client errors next to javascript errors in the Electron/Chrome DevTools console.
|
While in development mode, Flipper will display any client errors next to javascript errors in the Electron/Chrome DevTools console.
|
||||||
|
|
||||||
## Testing
|
## Testing
|
||||||
Testing is incredibly important when building core infrastructure and tools. The following is pseudo code for tests we would expect any new FlipperClient implementation to implement and correctly execute. To run tests we strongly encourage you to build a mock for the RSocket connection to mock out the desktop side of the protocol and to not have any network dependencies in your test code.
|
Testing is incredibly important when building core infrastructure and tools. The following is pseudo code for tests we would expect any new FlipperClient implementation to implement and correctly execute. To run tests we strongly encourage you to build a mock for the WebSocket connection to mock out the desktop side of the protocol and to not have any network dependencies in your test code.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
test("GetPlugins", {
|
test("GetPlugins", {
|
||||||
|
|||||||
Reference in New Issue
Block a user