@onekeyfe/react-native-tcp-socket 3.0.162 → 3.0.163
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -0
- package/package.json +5 -4
package/README.md
CHANGED
|
@@ -1,5 +1,41 @@
|
|
|
1
1
|
# @onekeyfe/react-native-tcp-socket
|
|
2
2
|
|
|
3
|
+
Native TCP connection diagnostics for OneKey on iOS and Android. The package
|
|
4
|
+
provides a promise-based connection attempt and a small legacy-style wrapper;
|
|
5
|
+
it is not a general-purpose streaming socket implementation.
|
|
6
|
+
|
|
7
|
+
## Installation and usage
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
yarn add @onekeyfe/react-native-tcp-socket
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Install the application's iOS pods and rebuild the native application.
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { NativeTcpSocket } from '@onekeyfe/react-native-tcp-socket';
|
|
17
|
+
|
|
18
|
+
const connectionMs = await NativeTcpSocket.connectWithTimeout('example.com', 443, 5000);
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## API and wrapper limits
|
|
22
|
+
|
|
23
|
+
`connectWithTimeout(host, port, timeoutMs)` resolves with connection time in
|
|
24
|
+
milliseconds and rejects on connection failure. Callers own retry and how the
|
|
25
|
+
measurement is interpreted. A TCP connection does not verify TLS or an
|
|
26
|
+
application-level protocol.
|
|
27
|
+
|
|
28
|
+
The default export offers `createConnection(options, connectCallback)` with
|
|
29
|
+
`on('error', handler)`, `on('timeout', handler)` and `destroy()`. Its default
|
|
30
|
+
timeout is 5000 ms. `destroy()` suppresses later wrapper callbacks; it does not
|
|
31
|
+
expose native cancellation or a readable/writable socket stream.
|
|
32
|
+
|
|
33
|
+
Do not assume Node.js socket methods are available on that wrapper. See
|
|
34
|
+
[src/index.tsx](src/index.tsx) for its behavior and
|
|
35
|
+
[src/NativeTcpSocket.ts](src/NativeTcpSocket.ts) for the native signature.
|
|
36
|
+
|
|
37
|
+
## Upstream attribution
|
|
38
|
+
|
|
3
39
|
First, a sincere thank-you to Rapsssito and the
|
|
4
40
|
`react-native-tcp-socket` maintainers for their excellent work 🙏
|
|
5
41
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/react-native-tcp-socket",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.163",
|
|
4
4
|
"description": "react-native-tcp-socket",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|
|
@@ -41,14 +41,15 @@
|
|
|
41
41
|
],
|
|
42
42
|
"repository": {
|
|
43
43
|
"type": "git",
|
|
44
|
-
"url": "git+https://github.com/OneKeyHQ/app-modules
|
|
44
|
+
"url": "git+https://github.com/OneKeyHQ/app-modules.git",
|
|
45
|
+
"directory": "native-modules/react-native-tcp-socket"
|
|
45
46
|
},
|
|
46
47
|
"author": "@onekeyhq <huanming@onekey.so> (https://github.com/OneKeyHQ/app-modules)",
|
|
47
48
|
"license": "MIT",
|
|
48
49
|
"bugs": {
|
|
49
|
-
"url": "https://github.com/OneKeyHQ/app-modules/
|
|
50
|
+
"url": "https://github.com/OneKeyHQ/app-modules/issues"
|
|
50
51
|
},
|
|
51
|
-
"homepage": "https://github.com/OneKeyHQ/app-modules/react-native-tcp-socket#readme",
|
|
52
|
+
"homepage": "https://github.com/OneKeyHQ/app-modules/tree/main/native-modules/react-native-tcp-socket#readme",
|
|
52
53
|
"publishConfig": {
|
|
53
54
|
"registry": "https://registry.npmjs.org/"
|
|
54
55
|
},
|